-
Notifications
You must be signed in to change notification settings - Fork 228
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
Introduce case insensitive equality rsql operator. Default is case sensitive #1519
Conversation
@@ -59,6 +60,8 @@ | |||
private static final String SINGLE_PARAMETER_ONLY = "There can only be a single filter query parameter"; | |||
private static final String INVALID_QUERY_PARAMETER = "Invalid query parameter: "; | |||
private static final Pattern TYPED_FILTER_PATTERN = Pattern.compile("filter\\[([^\\]]+)\\]"); | |||
private static final ComparisonOperator INI = new ComparisonOperator("=ini=", true); | |||
private static final ComparisonOperator NOT_INI = new ComparisonOperator("=outi=", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but we should add all the insensitive operators here as well (PREFIXI, INFIXI, etc)
return equalityExpression(arguments.get(0), path, values); | ||
return equalityExpression(arguments.get(0), path, values, true); | ||
} | ||
if (op.equals(INI)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make these else if statements.
return new NotFilterExpression(equalityExpression(arguments.get(0), path, values)); | ||
return new NotFilterExpression(equalityExpression(arguments.get(0), path, values, true)); | ||
} | ||
if (op.equals(NOT_INI)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to add explicit conditions for INFIXI, PREFIX, etc.
…nsitive (#1519) * introduce case insensitive equality rsql operator. Default is case sensitive * refactoring Co-authored-by: Chandrasekar Rajasekar <[email protected]>
…nsitive (#1519) * introduce case insensitive equality rsql operator. Default is case sensitive * refactoring Co-authored-by: Chandrasekar Rajasekar <[email protected]>
…nsitive (#1519) * introduce case insensitive equality rsql operator. Default is case sensitive * refactoring Co-authored-by: Chandrasekar Rajasekar <[email protected]>
Description
RSQL default operations are made case sensitive. Case Insensitive Equality operators are added.
==
and=in=
are now Case Sensitive=ini=
is the case insensitive equivalent.Usage :
=ini='val'
-> IN_INSENSITIVE=ini='*val'
-> PREFIX_CASE_INSENSITIVE=ini='*val*'
-> INFIX_CASE_INSENSITIVE=ini='val*'
-> POSTFIX_CASE_INSENSITIVE=in='val'
or=='val'
-> IN=in='*val'
or=='*val'
-> PREFIX=in='*val*'
or=='*val*'
-> INFIX=in='val*'
or=='val*'
-> POSTFIXMotivation and Context
Having a default case insensitive filter bypasses the datastore index (if exist) thereby making queries slow. User needs to select whether they want CI or CS filter.
How Has This Been Tested?
Integration test and Unit Test
License
I confirm that this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.