Skip to content

Conversation

ninoseki
Copy link
Contributor

@ninoseki ninoseki commented May 3, 2024

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

Copy link
Member

@slorello89 slorello89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 , just made the case_sensitive snake case to be consistent with other fields in the Field function (ironic given I'm adding startswith and endswith in another pr, but a bit more consistent all the same.) Thank you for submitting this!

@slorello89 slorello89 merged commit 5ef3d27 into redis:main May 3, 2024
@ninoseki ninoseki deleted the casesensitive branch May 4, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants