diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml
index 476d1269884..69ecb69d32a 100644
--- a/buildSrc/src/main/resources/checkstyle_suppressions.xml
+++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml
@@ -1273,7 +1273,6 @@
-
@@ -1447,7 +1446,6 @@
-
diff --git a/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java b/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java
index d8d018284e9..d9f70978ee2 100644
--- a/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java
+++ b/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java
@@ -22,6 +22,7 @@ package org.elasticsearch.index.query;
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.io.JsonStringEncoder;
+
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
@@ -56,7 +57,6 @@ import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.common.settings.SettingsModule;
import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.common.xcontent.ToXContent;
@@ -89,9 +89,9 @@ import org.elasticsearch.script.ScriptContext;
import org.elasticsearch.script.ScriptContextRegistry;
import org.elasticsearch.script.ScriptEngineRegistry;
import org.elasticsearch.script.ScriptEngineService;
-import org.elasticsearch.script.ScriptSettings;
import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.ScriptService;
+import org.elasticsearch.script.ScriptSettings;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.test.ESTestCase;
diff --git a/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java
index 190824a1ced..3da15049672 100644
--- a/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java
+++ b/core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java
@@ -297,7 +297,8 @@ public class SimpleQueryStringBuilderTests extends AbstractQueryTestCase 1) {
+ expectedMinimumShouldMatch = 0;
+ }
+ assertEquals(expectedMinimumShouldMatch, boolQuery.getMinimumNumberShouldMatch());
+ }
+ }
}
diff --git a/core/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java b/core/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java
index 923153a7dd0..1a585db3934 100644
--- a/core/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java
+++ b/core/src/test/java/org/elasticsearch/search/query/SimpleQueryStringIT.java
@@ -116,12 +116,21 @@ public class SimpleQueryStringIT extends ESIntegTestCase {
assertSearchHits(searchResponse, "3", "4");
logger.info("--> query 2");
- searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo bar").field("body").field("body2").minimumShouldMatch("2")).get();
+ searchResponse = client().prepareSearch()
+ .setQuery(simpleQueryStringQuery("foo bar").field("body").field("body2").minimumShouldMatch("2")).get();
assertHitCount(searchResponse, 2L);
assertSearchHits(searchResponse, "3", "4");
+ // test case from #13884
logger.info("--> query 3");
- searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo bar baz").field("body").field("body2").minimumShouldMatch("70%")).get();
+ searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo")
+ .field("body").field("body2").field("body3").minimumShouldMatch("-50%")).get();
+ assertHitCount(searchResponse, 3L);
+ assertSearchHits(searchResponse, "1", "3", "4");
+
+ logger.info("--> query 4");
+ searchResponse = client().prepareSearch()
+ .setQuery(simpleQueryStringQuery("foo bar baz").field("body").field("body2").minimumShouldMatch("70%")).get();
assertHitCount(searchResponse, 2L);
assertSearchHits(searchResponse, "3", "4");
@@ -131,18 +140,20 @@ public class SimpleQueryStringIT extends ESIntegTestCase {
client().prepareIndex("test", "type1", "7").setSource("body2", "foo bar", "other", "foo"),
client().prepareIndex("test", "type1", "8").setSource("body2", "foo baz bar", "other", "foo"));
- logger.info("--> query 4");
- searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo bar").field("body").field("body2").minimumShouldMatch("2")).get();
+ logger.info("--> query 5");
+ searchResponse = client().prepareSearch()
+ .setQuery(simpleQueryStringQuery("foo bar").field("body").field("body2").minimumShouldMatch("2")).get();
assertHitCount(searchResponse, 4L);
assertSearchHits(searchResponse, "3", "4", "7", "8");
- logger.info("--> query 5");
+ logger.info("--> query 6");
searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo bar").minimumShouldMatch("2")).get();
assertHitCount(searchResponse, 5L);
assertSearchHits(searchResponse, "3", "4", "6", "7", "8");
- logger.info("--> query 6");
- searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("foo bar baz").field("body2").field("other").minimumShouldMatch("70%")).get();
+ logger.info("--> query 7");
+ searchResponse = client().prepareSearch()
+ .setQuery(simpleQueryStringQuery("foo bar baz").field("body2").field("other").minimumShouldMatch("70%")).get();
assertHitCount(searchResponse, 3L);
assertSearchHits(searchResponse, "6", "7", "8");
}
@@ -330,7 +341,8 @@ public class SimpleQueryStringIT extends ESIntegTestCase {
indexRandom(true, client().prepareIndex("test1", "type1", "1").setSource("location", "Köln"));
refresh();
- SearchResponse searchResponse = client().prepareSearch().setQuery(simpleQueryStringQuery("Köln*").analyzeWildcard(true).field("location")).get();
+ SearchResponse searchResponse = client().prepareSearch()
+ .setQuery(simpleQueryStringQuery("Köln*").analyzeWildcard(true).field("location")).get();
assertNoFailures(searchResponse);
assertHitCount(searchResponse, 1L);
assertSearchHits(searchResponse, "1");