- Direct Known Subclasses:
public abstract class Filter extends org.apache.lucene.search.QueryConvenient base class for building queries that only perform matching, but no scoring. The scorer produced by such queries always returns 0 as score.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, float boost)
getDocIdSet(org.apache.lucene.index.LeafReaderContext context, org.apache.lucene.util.Bits acceptDocs)Creates a
DocIdSetenumerating the documents that should be permitted in search results.
Methods inherited from class org.apache.lucene.search.Query
classHash, equals, hashCode, rewrite, sameClassAs, toString, toString
protected Filter(boolean applyLazily)Filter constructor. When
applyLazilyis true and the produced
random-access, Lucene will only apply this filter after other clauses.
protected Filter()Default Filter constructor that will use the
doc id set iteratorwhen consumed through the
public abstract org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.LeafReaderContext context, org.apache.lucene.util.Bits acceptDocs) throws IOExceptionCreates a
DocIdSetenumerating the documents that should be permitted in search results. NOTE: null can be returned if no documents are accepted by this Filter.
Note: This method will be called once per segment in the index during searching. The returned
DocIdSetmust refer to document IDs for that segment, not for the top-level reader.
LeafReaderContextinstance opened on the index currently searched on. Note, it is likely that the provided reader info does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment. The provided context is always an atomic context, so you can call
LeafReader.terms(String)on the context's reader, for example.
acceptDocs- Bits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents)
- a DocIdSet that provides the documents which should be permitted or
prohibited in search results. NOTE:
nullshould be returned if the filter doesn't accept any documents otherwise internal optimization might not apply in the case an empty