nested: child level filter should be a regular filter!

This commit is contained in:
Martijn van Groningen 2015-08-24 22:06:02 +02:00
parent d7327b7b31
commit ee2a5fc2bc
2 changed files with 4 additions and 4 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.query.support; package org.elasticsearch.index.query.support;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.join.BitDocIdSetFilter; import org.apache.lucene.search.join.BitDocIdSetFilter;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
@ -26,7 +27,6 @@ import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.object.ObjectMapper; import org.elasticsearch.index.mapper.object.ObjectMapper;
import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.index.query.QueryParsingException; import org.elasticsearch.index.query.QueryParsingException;
@ -54,7 +54,7 @@ public class NestedInnerQueryParseSupport {
protected boolean filterFound = false; protected boolean filterFound = false;
protected BitDocIdSetFilter parentFilter; protected BitDocIdSetFilter parentFilter;
protected BitDocIdSetFilter childFilter; protected Filter childFilter;
protected ObjectMapper nestedObjectMapper; protected ObjectMapper nestedObjectMapper;
private ObjectMapper parentObjectMapper; private ObjectMapper parentObjectMapper;
@ -191,7 +191,7 @@ public class NestedInnerQueryParseSupport {
} else { } else {
parentFilter = parseContext.bitsetFilter(objectMapper.nestedTypeFilter()); parentFilter = parseContext.bitsetFilter(objectMapper.nestedTypeFilter());
} }
childFilter = parseContext.bitsetFilter(nestedObjectMapper.nestedTypeFilter()); childFilter = nestedObjectMapper.nestedTypeFilter();
parentObjectMapper = parseContext.nestedScope().nextLevel(nestedObjectMapper); parentObjectMapper = parseContext.nestedScope().nextLevel(nestedObjectMapper);
} }

View File

@ -2452,7 +2452,7 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
Query parsedQuery = queryParser.parse(query).query(); Query parsedQuery = queryParser.parse(query).query();
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class)); assertThat(parsedQuery, instanceOf(ConstantScoreQuery.class));
assertThat(((ConstantScoreQuery) parsedQuery).getQuery(), instanceOf(ToParentBlockJoinQuery.class)); assertThat(((ConstantScoreQuery) parsedQuery).getQuery(), instanceOf(ToParentBlockJoinQuery.class));
assertThat(((ConstantScoreQuery) parsedQuery).getQuery().toString(), equalTo("ToParentBlockJoinQuery (+*:* #random_access(QueryWrapperFilter(_type:__nested)))")); assertThat(((ConstantScoreQuery) parsedQuery).getQuery().toString(), equalTo("ToParentBlockJoinQuery (+*:* #QueryWrapperFilter(_type:__nested))"));
SearchContext.removeCurrent(); SearchContext.removeCurrent();
} }