Fixes QueryStringQueryBuilderTests

Closes #27246
This commit is contained in:
Colin Goodheart-Smithe 2017-11-03 13:21:44 +00:00
parent 9e67cca987
commit 20e8005859
No known key found for this signature in database
GPG Key ID: F975E7BDD739B3C7
1 changed files with 2 additions and 1 deletions

View File

@ -806,7 +806,8 @@ public class QueryStringQueryBuilderTests extends AbstractQueryTestCase<QueryStr
QueryStringQueryBuilder queryBuilder = new QueryStringQueryBuilder(STRING_FIELD_NAME + ":*"); QueryStringQueryBuilder queryBuilder = new QueryStringQueryBuilder(STRING_FIELD_NAME + ":*");
Query query = queryBuilder.toQuery(context); Query query = queryBuilder.toQuery(context);
if (getCurrentTypes().length > 0) { if (getCurrentTypes().length > 0) {
if (context.getIndexSettings().getIndexVersionCreated().onOrAfter(Version.V_6_1_0)) { if (context.getIndexSettings().getIndexVersionCreated().onOrAfter(Version.V_6_1_0)
&& (context.fieldMapper(STRING_FIELD_NAME).omitNorms() == false)) {
assertThat(query, equalTo(new ConstantScoreQuery(new NormsFieldExistsQuery(STRING_FIELD_NAME)))); assertThat(query, equalTo(new ConstantScoreQuery(new NormsFieldExistsQuery(STRING_FIELD_NAME))));
} else { } else {
assertThat(query, equalTo(new ConstantScoreQuery(new TermQuery(new Term("_field_names", STRING_FIELD_NAME))))); assertThat(query, equalTo(new ConstantScoreQuery(new TermQuery(new Term("_field_names", STRING_FIELD_NAME)))));