mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-21 12:27:37 +00:00
Use default forceAnalyzeQueryString if no query builder is present
In the single field case no query builder is selected which causes NPE when the query has only a numeric field. Closes #6215
This commit is contained in:
parent
1e5138889e
commit
dab4596b13
@ -263,6 +263,6 @@ public class MultiMatchQuery extends MatchQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean forceAnalyzeQueryString() {
|
protected boolean forceAnalyzeQueryString() {
|
||||||
return this.queryBuilder.forceAnalyzeQueryString();
|
return this.queryBuilder == null ? super.forceAnalyzeQueryString() : this.queryBuilder.forceAnalyzeQueryString();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -210,6 +210,15 @@ public class MultiMatchQueryTests extends ElasticsearchIntegrationTest {
|
|||||||
assertHitCount(searchResponse, 2l);
|
assertHitCount(searchResponse, 2l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSingleField() {
|
||||||
|
SearchResponse searchResponse = client().prepareSearch("test")
|
||||||
|
.setQuery(randomizeType(multiMatchQuery("15", "skill"))).get();
|
||||||
|
assertNoFailures(searchResponse);
|
||||||
|
assertFirstHit(searchResponse, hasId("theone"));
|
||||||
|
// TODO we need equivalence tests with match query here
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCutoffFreq() throws ExecutionException, InterruptedException {
|
public void testCutoffFreq() throws ExecutionException, InterruptedException {
|
||||||
final long numDocs = client().prepareCount("test")
|
final long numDocs = client().prepareCount("test")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user