From b8dd7e688e20f7cf4aa1dd86cb4d89c36046fb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Fri, 12 Jun 2015 00:11:56 +0200 Subject: [PATCH] Tests: Fix ExistsQueryBuilderTest after changes to builder merged in from master --- .../elasticsearch/index/query/ExistsQueryBuilderTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTest.java b/core/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTest.java index ef508a490b5..47924432e33 100644 --- a/core/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTest.java +++ b/core/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTest.java @@ -24,7 +24,6 @@ import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermRangeQuery; -import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.index.mapper.MappedFieldType; @@ -35,10 +34,9 @@ import java.util.Collection; import static org.hamcrest.Matchers.equalTo; -@AwaitsFix(bugUrl="fails with random seeds given here http://build-us-00.elastic.co/job/es_feature_query_refactoring/2011/") public class ExistsQueryBuilderTest extends BaseQueryTestCase { - private Collection getFieldNamePattern(String fieldName, QueryParseContext context) { + private static Collection getFieldNamePattern(String fieldName, QueryParseContext context) { if (getCurrentTypes().length > 0 && fieldName.equals(BaseQueryTestCase.OBJECT_FIELD_NAME)) { // "object" field has two inner fields (age, price), so if query hits that field, we // extend field name with wildcard to match both nested fields. This is similar to what @@ -78,8 +76,10 @@ public class ExistsQueryBuilderTest extends BaseQueryTestCase fields = getFieldNamePattern(queryBuilder.name(), context); + final FieldNamesFieldMapper.FieldNamesFieldType fieldNamesFieldType = (FieldNamesFieldMapper.FieldNamesFieldType) + context.mapperService().fullName(FieldNamesFieldMapper.NAME); - if (fields.isEmpty()) { + if (fieldNamesFieldType == null || fields.isEmpty()) { assertNull(namedQuery); } else { query = ((ConstantScoreQuery) query).getQuery();