redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.11k stars 110 forks source link

feat: add casesensitive support #608

Closed ninoseki closed 5 months ago

ninoseki commented 5 months ago

This is a proposal to add CASESENSITIVE support in tag fields.

Tag fields are case-insensitive by default. But it's configurable by setting CASESENSITIVE and I believe there is a use case for it. (At least I have it) This PR makes it possible to set CASESENSITIVE in a schema by setting casesenstive option in a field like what sortable does.

  class Member(BaseHashModel):
      id: int = Field(index=True, primary_key=True)
      first_name: str = Field(index=True, casesensitive=True)
      ...

Member.find(Member.first_name == "andrew").all()
# hits 0 members because the field is case-sensitive