IntervalQueryBuilderTests#testNonIndexedFields test fix (#40418)
This test checks that interval queries constructed against a field with no indexed positions will throw exceptions. It uses a randomly-build IntervalsSourceProvider against a fixed set of fields; however, the random source builder can occasionally provide a source with a fixed field, meaning that even if the top-level query asks for a set of intervals over a non-indexed field, the source will delegate to another field, and no exception will be thrown. This commit changes the test to always use a simple Match provider. Fixes #40436
This commit is contained in:
parent
cafb83297c
commit
12634850d6
|
@ -294,7 +294,7 @@ public class IntervalQueryBuilderTests extends AbstractQueryTestCase<IntervalQue
|
|||
}
|
||||
|
||||
public void testNonIndexedFields() throws IOException {
|
||||
IntervalsSourceProvider provider = createRandomSource();
|
||||
IntervalsSourceProvider provider = new IntervalsSourceProvider.Match("test", 0, true, null, null, null);
|
||||
IntervalQueryBuilder b = new IntervalQueryBuilder("no_such_field", provider);
|
||||
assertThat(b.toQuery(createShardContext()), equalTo(new MatchNoDocsQuery()));
|
||||
|
||||
|
|
Loading…
Reference in New Issue