Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions redisearch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class TextField(Field):
def __init__(self, name, weight=1.0, sortable=False, no_stem=False,
no_index=False):
args = [Field.TEXT, Field.WEIGHT, weight]
if sortable:
args.append(Field.SORTABLE)
if no_stem:
args.append(self.NOSTEM)
if sortable:
args.append(Field.SORTABLE)
if no_index:
args.append(self.NOINDEX)

Expand Down
16 changes: 16 additions & 0 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,22 @@ def testTags(self):
res = client.search(q)
self.assertEqual(1, res.total)

def testTextFieldSortableNostem(self):
conn = self.redis()

with conn as r:
# Creating a client with a given index name
client = Client('sortableNostem', port=conn.port)
client.redis.flushdb()

# Creating the index definition with sortable and no_stem
client.create_index((TextField('txt', sortable=True, no_stem=True),))

# Now get the index info to confirm its contents
response = client.info()
self.assertIn(b'SORTABLE', response['fields'][0])
self.assertIn(b'NOSTEM', response['fields'][0])

if __name__ == '__main__':

unittest.main()