Description
When using redis-py with RediSearch, the parser currently expects the INDEXMISSING or INDEXEMPTY flags to appear before SORTABLE. However, the current implementation appends SORTABLE first, leading to an error when SORTABLE precedes the missing/empty flags.
if sortable:
self.args_suffix.append(Field.SORTABLE)
if no_index:
self.args_suffix.append(Field.NOINDEX)
if index_missing:
self.args_suffix.append(Field.INDEX_MISSING)
if index_empty:
self.args_suffix.append(Field.INDEX_EMPTY)
This causes parsing errors when SORTABLE is placed before INDEXMISSING or INDEXEMPTY.
Expected behavior:
INDEXMISSING and INDEXEMPTY should be emitted before SORTABLE, to align with RediSearch’s parser expectations.
Suggested fix:
Reorder the code to emit INDEXMISSING and INDEXEMPTY before SORTABLE.