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

Introduce case insensitive equality rsql operator. Default is case sensitive #1519

Merged
merged 2 commits into from
Sep 1, 2020

Conversation

Chandrasekar-Rajasekar
Copy link
Collaborator

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*' -> POSTFIX

Motivation 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.

@Chandrasekar-Rajasekar Chandrasekar-Rajasekar changed the title introduce case insensitive equality rsql operator. Default is case sensitive Introduce case insensitive equality rsql operator. Default is case sensitive Aug 31, 2020
@coveralls
Copy link
Collaborator

coveralls commented Aug 31, 2020

Coverage Status

Coverage increased (+0.02%) to 80.896% when pulling 3d4d4ea on case_insensitive_operator into be2d25b on elide-5.x.

@@ -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);
Copy link
Member

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)) {
Copy link
Member

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)) {
Copy link
Member

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.

@aklish aklish merged commit d80e181 into elide-5.x Sep 1, 2020
@aklish aklish deleted the case_insensitive_operator branch September 1, 2020 21:40
aklish pushed a commit that referenced this pull request Sep 22, 2020
…nsitive (#1519)

* introduce case insensitive equality rsql operator. Default is case sensitive

* refactoring

Co-authored-by: Chandrasekar Rajasekar <[email protected]>
aklish pushed a commit that referenced this pull request Nov 17, 2020
…nsitive (#1519)

* introduce case insensitive equality rsql operator. Default is case sensitive

* refactoring

Co-authored-by: Chandrasekar Rajasekar <[email protected]>
aklish pushed a commit that referenced this pull request Dec 11, 2020
…nsitive (#1519)

* introduce case insensitive equality rsql operator. Default is case sensitive

* refactoring

Co-authored-by: Chandrasekar Rajasekar <[email protected]>
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.

3 participants