-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 case insensitive prefix and wildcard to 'version' field #62754
Add case insensitive prefix and wildcard to 'version' field #62754
Conversation
Pinging @elastic/es-search (:Search/Mapping) |
@markharwood would you mind taking a look since you worked on the case insensitivity option lately? |
} | ||
|
||
protected static Automaton toCaseInsensitiveChar(int codepoint, int maxDeterminizedStates) { | ||
public static Automaton toCaseInsensitiveChar(int codepoint, int maxDeterminizedStates) { |
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.
Wanted to use this, let me know if this shouldn't be that open. Another option is simpyl copying the logic over I think.
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.
LGTM
I'm working on backporting the case insensitive term/prefix/wildcard query support to 7.x here |
@@ -139,7 +139,7 @@ public Query existsQuery(QueryShardContext context) { | |||
|
|||
@Override | |||
public Query prefixQuery(String value, MultiTermQuery.RewriteMethod method, boolean caseInsensitve, QueryShardContext context) { | |||
return wildcardQuery(value + "*", method, context); | |||
return wildcardQuery(value + "*", method, caseInsensitve, context); | |||
} |
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.
Typo - missing i in Insensitive.
@@ -244,7 +244,7 @@ public Query wildcardQuery(String value, MultiTermQuery.RewriteMethod method, bo | |||
); | |||
} | |||
|
|||
VersionFieldWildcardQuery query = new VersionFieldWildcardQuery(new Term(name(), value)); | |||
VersionFieldWildcardQuery query = new VersionFieldWildcardQuery(new Term(name(), value), caseInsensitve); | |||
QueryParsers.setRewriteMethod(query, method); |
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.
Typo
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.
Couple of typos but otherwise LGTM
@markharwood thanks for the review. Sure I'll wait for your backport to 7.x before backporting this PR then. |
@cbuescher The 7.x backport is merged now |
@elasticmachine update branch |
@elasticmachine update branch |
…62754) This change adds support for the recently introduced case insensitivity flag for wildcard and prefix queries. Since version field values are encoded differently we need to adapt our own AutomatonQuery variation to add both cases if case insensitivity is turned on.
…62782) This change adds support for the recently introduced case insensitivity flag for wildcard and prefix queries. Since version field values are encoded differently we need to adapt our own AutomatonQuery variation to add both cases if case insensitivity is turned on.
This change adds support for the recently introduced case insensitivity flag for
wildcard and prefix queries. Since version field values are encoded differently we
need to adapt our own AutomatonQuery variation to add both cases if case insensitivity
is turned on.