mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-29 10:57:52 +00:00
Advance search - Added case sensitive flag for wildcard searches (#11272)
Co-authored-by: mac <mac@192.168.1.7> Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com> Co-authored-by: Kanav Narula <kanav_narula@optum.com>
This commit is contained in:
parent
8ea211712c
commit
4693ab0521
@ -637,7 +637,8 @@ public class ESUtils {
|
||||
QueryBuilders.wildcardQuery(
|
||||
toKeywordField(criterion.getField(), isTimeseries, aspectRetriever),
|
||||
String.format(wildcardPattern, ESUtils.escapeReservedCharacters(value.trim())))
|
||||
.queryName(queryName != null ? queryName : fieldName));
|
||||
.queryName(queryName != null ? queryName : fieldName)
|
||||
.caseInsensitive(true));
|
||||
}
|
||||
return boolQuery;
|
||||
}
|
||||
@ -653,7 +654,8 @@ public class ESUtils {
|
||||
toKeywordField(criterion.getField(), isTimeseries, aspectRetriever),
|
||||
String.format(
|
||||
wildcardPattern, ESUtils.escapeReservedCharacters(criterion.getValue().trim())))
|
||||
.queryName(queryName != null ? queryName : fieldName);
|
||||
.queryName(queryName != null ? queryName : fieldName)
|
||||
.caseInsensitive(true);
|
||||
}
|
||||
|
||||
private static QueryBuilder buildContainsConditionFromCriterion(
|
||||
|
||||
@ -177,6 +177,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value1*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -207,6 +208,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value1*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -216,6 +218,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value2*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -251,6 +254,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"value1*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -281,6 +285,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"value1*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -290,6 +295,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"value2*\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -322,6 +328,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value1\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -351,6 +358,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value1\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
@ -360,6 +368,7 @@ public class ESUtilsTest {
|
||||
+ " \"wildcard\" : {\n"
|
||||
+ " \"myTestField.keyword\" : {\n"
|
||||
+ " \"wildcard\" : \"*value2\",\n"
|
||||
+ " \"case_insensitive\" : true,\n"
|
||||
+ " \"boost\" : 1.0,\n"
|
||||
+ " \"_name\" : \"myTestField\"\n"
|
||||
+ " }\n"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user