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

Add new filters for String types to enable case-insensitive filtering #4827

Open
andreloeffelmann opened this issue Mar 6, 2024 · 3 comments
Labels
feature request New feature or request

Comments

@andreloeffelmann
Copy link

Is your feature request related to a problem? Please describe.
When filtering for fields of type String in queries the passed filter values are compared case-sensitive to the database values, see here.
It is common (at least for our data) that some values are stored with uppercase letters in the database.
When querying the API our users are often not aware of how the data is actually written (uppercase/lowercase) which leads to zero rows being returned by the filtering if the passed values do not match the underlying data exactly.

Describe the solution you'd like
It would be great if the existing String filters could be extended, e.g. like this:

  • [fieldName]_IGNORING_CASE
  • [fieldName]_STARTS_WITH_IGNORING_CASE
  • [fieldName]_ENDS_WITH_IGNORING_CASE
  • [fieldName]_CONTAINS_IGNORING_CASE
  • [fieldName]_IN_IGNORING_CASE

Or maybe just with an abbreviation, like [fieldName]_IN_IC, I don't care too much about the actual spelling.

To be clear: the existing filters

  • [fieldName]
  • [fieldName]_STARTS_WITH
  • [fieldName]_ENDS_WITH
  • [fieldName]_CONTAINS
  • [fieldName]_IN

should remain. They still make sense for some usecases.

If schema bloating is a concern here, maybe it is an idea to enable the additional case-insensitive filters by a directive or the global configuration...

Describe alternatives you've considered
We evaluated the _MATCHES filter via regex. Even if this can solve our problem, we hesitate to enable this filter because of the ReDoS attack possibilities as stated in your docs.

Additional context
This may also solve #4117

@andreloeffelmann andreloeffelmann added the feature request New feature or request label Mar 6, 2024
@btroop
Copy link

btroop commented Apr 13, 2024

extending this to sorting could be great as well...since sorting usually prioritizes uppercase over lowercase

@andreloeffelmann
Copy link
Author

Hey @darrellwarde, any plans on implementing this?
Some time has been passed since my initial post and no one ever replied.
The related ticket #4117 has been labelled with small, so I guess this should not be THAT troublesome to implement?

@darrellwarde
Copy link
Contributor

Hey @darrellwarde, any plans on implementing this? Some time has been passed since my initial post and no one ever replied. The related ticket #4117 has been labelled with small, so I guess this should not be THAT troublesome to implement?

Hey @andreloeffelmann, this hasn't been implemented because with the library's current design, it will just massively blow up schema size. We're currently working on major releases where we aim to address this, and we will revisit features such as these at that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants