Skip to content

Commit

Permalink
Search case insensitivity - complete the version dance now the back p…
Browse files Browse the repository at this point in the history
…ort is complete.

Relates to elastic#61546
  • Loading branch information
markharwood committed Sep 23, 2020
1 parent daade44 commit 64b94fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ protected PrefixQueryBuilder doCreateTestQueryBuilder() {
if (randomBoolean()) {
query.rewrite(getRandomRewriteMethod());
}
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// if (randomBoolean()) {
// query.caseInsensitive(true);
// }
if (randomBoolean()) {
query.caseInsensitive(true);
}
return query;
}

Expand Down Expand Up @@ -108,13 +104,8 @@ public void testBlendedRewriteMethod() throws IOException {

public void testFromJson() throws IOException {
String json =
"{ \"prefix\" : { \"user\" : { \"value\" : \"ki\", \"boost\" : 2.0 "
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// " \"case_insensitive\" : true\n" +

"{ \"prefix\" : { \"user\" : { \"value\" : \"ki\", \"boost\" : 2.0, "
+ " \"case_insensitive\" : true\n"
+ "} }}";

PrefixQueryBuilder parsed = (PrefixQueryBuilder) parseQuery(json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,9 @@ protected TermQueryBuilder doCreateTestQueryBuilder() {
@Override
protected TermQueryBuilder createQueryBuilder(String fieldName, Object value) {
TermQueryBuilder result = new TermQueryBuilder(fieldName, value);
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// if (randomBoolean()) {
// result.caseInsensitive(true);
// }
if (randomBoolean()) {
result.caseInsensitive(true);
}
return result;
}

Expand Down Expand Up @@ -142,12 +138,8 @@ public void testFromJson() throws IOException {
" \"term\" : {\n" +
" \"exact_value\" : {\n" +
" \"value\" : \"Quick Foxes!\",\n" +
" \"boost\" : 1.0\n" +
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// " \"case_insensitive\" : true\n" +
" \"boost\" : 1.0,\n" +
" \"case_insensitive\" : true\n" +
" }\n" +
" }\n" +
"}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ protected WildcardQueryBuilder doCreateTestQueryBuilder() {
if (randomBoolean()) {
query.rewrite(randomFrom(getRandomRewriteMethod()));
}
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// if (randomBoolean()) {
// query.caseInsensitive(true);
// }
if (randomBoolean()) {
query.caseInsensitive(true);
}
return query;
}

Expand Down Expand Up @@ -110,13 +106,8 @@ public void testEmptyValue() throws IOException {
}

public void testFromJson() throws IOException {
String json = "{ \"wildcard\" : { \"user\" : { \"wildcard\" : \"ki*y\", \"boost\" : 2.0"
//TODO code below is commented out while we do the Version dance for PR 61596. Steps are
// 1) Commit PR 61596 with this code commented out in master
// 2) Backport PR 61596 to 7.x, uncommented
// 3) New PR on master to uncomment this code now that 7.x has support for case insensitive flag.
// " \"case_insensitive\" : true\n" +

String json = "{ \"wildcard\" : { \"user\" : { \"wildcard\" : \"ki*y\", \"boost\" : 2.0,"
+ " \"case_insensitive\" : true\n"
+ " } }}";
WildcardQueryBuilder parsed = (WildcardQueryBuilder) parseQuery(json);
checkGeneratedJson(json, parsed);
Expand Down

0 comments on commit 64b94fa

Please sign in to comment.