From c21057b3a2503cb480ad5e631ecd39d46cbcef42 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 4 Apr 2018 12:47:37 +0200 Subject: [PATCH] Fix QueryAnalyzerTests. Closes #29363 --- .../org/elasticsearch/percolator/QueryAnalyzerTests.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java index 9f0714b4893..d9977c388b2 100644 --- a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java +++ b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java @@ -384,7 +384,6 @@ public class QueryAnalyzerTests extends ESTestCase { assertThat(terms.get(1).bytes(), equalTo(phraseQuery.getTerms()[1].bytes())); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29363") public void testExactMatch_booleanQuery() { BooleanQuery.Builder builder = new BooleanQuery.Builder(); TermQuery termQuery1 = new TermQuery(new Term("_field", "_term1")); @@ -419,12 +418,15 @@ public class QueryAnalyzerTests extends ESTestCase { assertThat(result.minimumShouldMatch, equalTo(1)); builder = new BooleanQuery.Builder(); - builder.setMinimumNumberShouldMatch(randomIntBetween(1, 2)); + int msm = randomIntBetween(2, 3); + builder.setMinimumNumberShouldMatch(msm); + TermQuery termQuery3 = new TermQuery(new Term("_field", "_term3")); builder.add(termQuery1, BooleanClause.Occur.SHOULD); builder.add(termQuery2, BooleanClause.Occur.SHOULD); + builder.add(termQuery3, BooleanClause.Occur.SHOULD); result = analyze(builder.build(), Version.CURRENT); assertThat("Minimum match has not impact on whether the result is verified", result.verified, is(true)); - assertThat("msm is at least two so result.minimumShouldMatch should 2 too", result.minimumShouldMatch, equalTo(2)); + assertThat("msm is at least two so result.minimumShouldMatch should 2 too", result.minimumShouldMatch, equalTo(msm)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); @@ -453,7 +455,6 @@ public class QueryAnalyzerTests extends ESTestCase { assertThat("Prohibited clause, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); - TermQuery termQuery3 = new TermQuery(new Term("_field", "_term3")); builder = new BooleanQuery.Builder() .add(new BooleanQuery.Builder() .add(termQuery1, Occur.FILTER)