Merge pull request #13087 from martijnvg/nested/child_filter_can_just_be_regular_filter

Nested query should only use bitset cache for parent filter
This commit is contained in:
Martijn van Groningen 2015-08-25 10:13:36 +02:00
commit 9f3043fc78
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -2452,7 +2452,7 @@ public class SimpleIndexQueryParserTests extends ESSingleNodeTestCase {
Query parsedQuery = queryParser.parse(query).query();
assertThat(parsedQuery, instanceOf(ConstantScoreQuery.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();
}