Skip to content

Commit c21057b

Browse files
committed
Fix QueryAnalyzerTests.
Closes #29363
1 parent c052e98 commit c21057b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ public void testExtractQueryMetadata_booleanQueryWithMustNot() {
384384
assertThat(terms.get(1).bytes(), equalTo(phraseQuery.getTerms()[1].bytes()));
385385
}
386386

387-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29363")
388387
public void testExactMatch_booleanQuery() {
389388
BooleanQuery.Builder builder = new BooleanQuery.Builder();
390389
TermQuery termQuery1 = new TermQuery(new Term("_field", "_term1"));
@@ -419,12 +418,15 @@ public void testExactMatch_booleanQuery() {
419418
assertThat(result.minimumShouldMatch, equalTo(1));
420419

421420
builder = new BooleanQuery.Builder();
422-
builder.setMinimumNumberShouldMatch(randomIntBetween(1, 2));
421+
int msm = randomIntBetween(2, 3);
422+
builder.setMinimumNumberShouldMatch(msm);
423+
TermQuery termQuery3 = new TermQuery(new Term("_field", "_term3"));
423424
builder.add(termQuery1, BooleanClause.Occur.SHOULD);
424425
builder.add(termQuery2, BooleanClause.Occur.SHOULD);
426+
builder.add(termQuery3, BooleanClause.Occur.SHOULD);
425427
result = analyze(builder.build(), Version.CURRENT);
426428
assertThat("Minimum match has not impact on whether the result is verified", result.verified, is(true));
427-
assertThat("msm is at least two so result.minimumShouldMatch should 2 too", result.minimumShouldMatch, equalTo(2));
429+
assertThat("msm is at least two so result.minimumShouldMatch should 2 too", result.minimumShouldMatch, equalTo(msm));
428430

429431
builder = new BooleanQuery.Builder();
430432
builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER);
@@ -453,7 +455,6 @@ public void testExactMatch_booleanQuery() {
453455
assertThat("Prohibited clause, so candidate matches are not verified", result.verified, is(false));
454456
assertThat(result.minimumShouldMatch, equalTo(1));
455457

456-
TermQuery termQuery3 = new TermQuery(new Term("_field", "_term3"));
457458
builder = new BooleanQuery.Builder()
458459
.add(new BooleanQuery.Builder()
459460
.add(termQuery1, Occur.FILTER)

0 commit comments

Comments
 (0)