redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.09k stars 108 forks source link

`datetime` fields are indexed as `TAG`, sortable queries fail silently #467

Open elicore opened 1 year ago

elicore commented 1 year ago

redis-om-python: 0.1.2 python: 3.10

When setting a datetime Field with index=True, the field index is created as a TAG. Queries that use > or < return no data, as the query expression is evaluated to "".

This happens in both HashModel and JsonModel.

If the field is also defined with sortable=True AND the model is a JsonModel, the model definition raises a RedisModelError:

In this Preview release, TAG fields cannot be marked as sortable. Problem field: end_date. See docs: TODO

However if the model is a HashModel, no such exception is raised.

Possible solutions: