Skip to content

Commit

Permalink
Fixing span gap builder tests (elastic#114218) (elastic#114219) (elas…
Browse files Browse the repository at this point in the history
…tic#114253)

With elastic#113251 having a SpanMatchNoDocsQuery is a valid response to the rewrite.

closes elastic#114218

(cherry picked from commit a83046a)
  • Loading branch information
benwtrent authored Oct 7, 2024
1 parent eeec634 commit 20a34f4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.apache.lucene.queries.spans.SpanQuery;
import org.apache.lucene.queries.spans.SpanTermQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.lucene.queries.SpanMatchNoDocsQuery;
import org.elasticsearch.test.AbstractQueryTestCase;

import java.io.IOException;
Expand Down Expand Up @@ -50,7 +51,9 @@ protected SpanNearQueryBuilder doCreateTestQueryBuilder() {
protected void doAssertLuceneQuery(SpanNearQueryBuilder queryBuilder, Query query, SearchExecutionContext context) throws IOException {
assertThat(
query,
either(instanceOf(SpanNearQuery.class)).or(instanceOf(SpanTermQuery.class)).or(instanceOf(MatchAllQueryBuilder.class))
either(instanceOf(SpanNearQuery.class)).or(instanceOf(SpanTermQuery.class))
.or(instanceOf(MatchAllQueryBuilder.class))
.or(instanceOf(SpanMatchNoDocsQuery.class))
);
if (query instanceof SpanNearQuery spanNearQuery) {
assertThat(spanNearQuery.getSlop(), equalTo(queryBuilder.slop()));
Expand Down

0 comments on commit 20a34f4

Please sign in to comment.