Skip to content

Commit

Permalink
change case-insensitive to false
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Huo <[email protected]>
  • Loading branch information
penghuo committed Dec 12, 2022
1 parent c5e8fc0 commit 6146db6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public class OperatorUtils {
* @return if text matches pattern returns true; else return false.
*/
public static ExprBooleanValue matches(ExprValue text, ExprValue pattern) {
return ExprBooleanValue
.of(Pattern.compile(patternToRegex(pattern.stringValue())).matcher(text.stringValue())
return ExprBooleanValue.of(
Pattern.compile(patternToRegex(pattern.stringValue()), Pattern.CASE_INSENSITIVE)
.matcher(text.stringValue())
.matches());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public QueryBuilder build(FunctionExpression func) {
*/
protected WildcardQueryBuilder createBuilder(String field, String query) {
String matchText = StringUtils.convertSqlWildcardToLucene(query);
return QueryBuilders.wildcardQuery(field, matchText);
return QueryBuilders.wildcardQuery(field, matchText).caseInsensitive(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void should_build_wildcard_query_for_like_expression() {
+ " \"wildcard\" : {\n"
+ " \"name\" : {\n"
+ " \"wildcard\" : \"*John?\",\n"
+ " \"case_insensitive\" : true,\n"
+ " \"boost\" : 1.0\n"
+ " }\n"
+ " }\n"
Expand Down Expand Up @@ -282,6 +283,7 @@ void should_use_keyword_for_multi_field_in_like_expression() {
+ " \"wildcard\" : {\n"
+ " \"name.keyword\" : {\n"
+ " \"wildcard\" : \"John*\",\n"
+ " \"case_insensitive\" : true,\n"
+ " \"boost\" : 1.0\n"
+ " }\n"
+ " }\n"
Expand Down

0 comments on commit 6146db6

Please sign in to comment.