Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add casesensitive support #608

Merged
merged 2 commits into from
May 3, 2024
Merged

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
12 checks passed
@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