top level filter not resulting in an actual filter is ignored

when parsing a filter, we use null to indicate that this filter should not match anything, the top level filter doesn't take it into account
fixes #3356
This commit is contained in:
Shay Banon 2013-07-19 13:12:23 +02:00
parent fe4c2a9d02
commit 74a7c46b0e
1 changed files with 7 additions and 1 deletions

View File

@ -19,6 +19,8 @@
package org.elasticsearch.search.query;
import org.apache.lucene.search.Filter;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.SearchParseElement;
import org.elasticsearch.search.internal.SearchContext;
@ -30,6 +32,10 @@ public class FilterParseElement implements SearchParseElement {
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
context.parsedFilter(context.queryParserService().parseInnerFilter(parser));
Filter filter = context.queryParserService().parseInnerFilter(parser);
if (filter == null) {
filter = Queries.MATCH_NO_FILTER;
}
context.parsedFilter(filter);
}
}