Class QueryToFilterAdapter<Q extends org.apache.lucene.search.Query>
java.lang.Object
org.elasticsearch.search.aggregations.bucket.filter.QueryToFilterAdapter<Q>
public class QueryToFilterAdapter<Q extends org.apache.lucene.search.Query>
extends java.lang.Object
Adapts a Lucene
Query
to the behaviors used be the
FiltersAggregator
. In general we try to delegate to Query
when we don't have a special optimization.-
Method Summary
Modifier and Type Method Description static QueryToFilterAdapter<?>
build(org.apache.lucene.search.IndexSearcher searcher, java.lang.String key, org.apache.lucene.search.Query query)
Build a filter for the query against the provided searcher.protected boolean
countCanUseMetadata(org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.Counter counter, org.apache.lucene.util.Bits live)
Would using index metadata likeIndexReader.docFreq(org.apache.lucene.index.Term)
orIndexReader.maxDoc()
to count the number of matching documents produce the same answer as collecting the results with a sequence likesearcher.collect(counter); return counter.readAndReset();
?java.lang.String
key()
Key for this filter.protected org.apache.lucene.search.IndexSearcher
searcher()
Searcher that this filter is targeting.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
build
public static QueryToFilterAdapter<?> build(org.apache.lucene.search.IndexSearcher searcher, java.lang.String key, org.apache.lucene.search.Query query) throws java.io.IOExceptionBuild a filter for the query against the provided searcher.Note: This method rewrites the query against the
IndexSearcher
- Throws:
java.io.IOException
-
key
public final java.lang.String key()Key for this filter. -
searcher
protected final org.apache.lucene.search.IndexSearcher searcher()Searcher that this filter is targeting. -
countCanUseMetadata
protected final boolean countCanUseMetadata(org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.Counter counter, org.apache.lucene.util.Bits live)Would using index metadata likeIndexReader.docFreq(org.apache.lucene.index.Term)
orIndexReader.maxDoc()
to count the number of matching documents produce the same answer as collecting the results with a sequence likesearcher.collect(counter); return counter.readAndReset();
?
-