parent/child: has_child has_parent queries shouldn't require search context

This commit is contained in:
Martijn van Groningen 2015-09-09 21:24:00 +02:00
parent 2eadc6d595
commit 314e1c8a3e
1 changed files with 1 additions and 6 deletions

View File

@ -222,12 +222,7 @@ public class HasChildQueryParser implements QueryParser {
@Override
public Query rewrite(IndexReader reader) throws IOException {
SearchContext searchContext = SearchContext.current();
if (searchContext == null) {
throw new IllegalArgumentException("Search context is required to be set");
}
IndexSearcher indexSearcher = searchContext.searcher();
IndexSearcher indexSearcher = new IndexSearcher(reader);
String joinField = ParentFieldMapper.joinField(parentType);
IndexParentChildFieldData indexParentChildFieldData = parentChildIndexFieldData.loadGlobal(indexSearcher.getIndexReader());
MultiDocValues.OrdinalMap ordinalMap = ParentChildIndexFieldData.getOrdinalMap(indexParentChildFieldData, parentType);