Hi, I’ve tried to recreate the problem you’ve seen using both the current master as well as the 1.4.0 version, but the behavior is as expected each time. Can you provide a script which creates the data and reproduces the problem you’re seeing? I don’t agree this is the correct behavior.
#!/usr/bin/env python
from redis import StrictRedis
rr = StrictRedis()
rr.flushdb()
rr.execute_command(‘ft.create’, ‘idx’, ‘schema’, ‘f1’, ‘text’, ‘f2’, ‘text’, ‘n1’, ‘numeric’, ‘sortable’)
rr.execute_command(‘ft.add’, ‘idx’, ‘doc1’, 1.0, ‘fields’, ‘f1’, ‘first 1’, ‘f2’, ‘first 2’, ‘n1’, 100)
rr.execute_command(‘ft.add’, ‘idx’, ‘doc2’, 1.0, ‘fields’, ‘f1’, ‘second 1’, ‘f2’, ‘second 2’, ‘n1’, 200)
rr.execute_command(‘ft.add’, ‘idx’, ‘doc3’, 1.0, ‘fields’, ‘f1’, ‘third 1’, ‘f2’, ‘third 2’, ‘n1’, 300)
print rr.execute_command(‘ft.search’, ‘idx’, ‘*’, ‘sortby’, ‘n1’, ‘asc’)
print rr.execute_command(‘ft.search’, ‘idx’, ‘*’, ‘sortby’, ‘n1’, ‘asc’, ‘LIMIT’, 0, 1)
print rr.execute_command(‘ft.search’, ‘idx’, ‘*’, ‘sortby’, ‘n1’, ‘asc’, ‘LIMIT’, 1, 1)
output:
[3L, ‘doc1’, [‘f1’, ‘first 1’, ‘f2’, ‘first 2’, ‘n1’, ‘100’], ‘doc2’, [‘f1’, ‘second 1’, ‘f2’, ‘second 2’, ‘n1’, ‘200’], ‘doc3’, [‘f1’, ‘third 1’, ‘f2’, ‘third 2’, ‘n1’, ‘300’]]
[3L, ‘doc1’, [‘f1’, ‘first 1’, ‘f2’, ‘first 2’, ‘n1’, ‘100’]]
[3L, ‘doc2’, [‘f1’, ‘second 1’, ‘f2’, ‘second 2’, ‘n1’, ‘200’]]
Note that you should verify you’re indeed using 1.4.0 or one of the newer versions. A while back, the parsing on the options was not as strict, and it may have been possible for options to just be ignored.
Mark Nunberg | Senior Software Engineer
Redis Labs - home of Redis
Email: mark@redislabs.com