Package org.apache.solr.search
Class FilteredDocIdSet
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- org.apache.solr.search.FilteredDocIdSet
-
- All Implemented Interfaces:
org.apache.lucene.util.Accountable
public abstract class FilteredDocIdSet extends org.apache.lucene.search.DocIdSetAbstract decorator class for a DocIdSet implementation that provides on-demand filtering/validation mechanism on a given DocIdSet.Technically, this same functionality could be achieved with ChainedFilter (under queries/), however the benefit of this class is it never materializes the full bitset for the filter. Instead, the
match(int)method is invoked on-demand, per docID visited during searching. If you know few docIDs will be visited, and the logic behindmatch(int)is relatively costly, this may be a better way to filter than ChainedFilter.- See Also:
DocIdSet
-
-
Constructor Summary
Constructors Constructor Description FilteredDocIdSet(org.apache.lucene.search.DocIdSet innerSet)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.util.Bitsbits()Collection<org.apache.lucene.util.Accountable>getChildResources()org.apache.lucene.search.DocIdSetgetDelegate()Return the wrappedDocIdSet.org.apache.lucene.search.DocIdSetIteratoriterator()Implementation of the contract to build a DocIdSetIterator.protected abstract booleanmatch(int docid)Validation method to determine whether a docid should be in the result set.longramBytesUsed()
-
-
-
Method Detail
-
getDelegate
public org.apache.lucene.search.DocIdSet getDelegate()
Return the wrappedDocIdSet.
-
ramBytesUsed
public long ramBytesUsed()
-
getChildResources
public Collection<org.apache.lucene.util.Accountable> getChildResources()
-
bits
public org.apache.lucene.util.Bits bits() throws IOException- Overrides:
bitsin classorg.apache.lucene.search.DocIdSet- Throws:
IOException
-
match
protected abstract boolean match(int docid)
Validation method to determine whether a docid should be in the result set.- Parameters:
docid- docid to be tested- Returns:
- true if input docid should be in the result set, false otherwise.
-
iterator
public org.apache.lucene.search.DocIdSetIterator iterator() throws IOExceptionImplementation of the contract to build a DocIdSetIterator.- Specified by:
iteratorin classorg.apache.lucene.search.DocIdSet- Throws:
IOException- See Also:
DocIdSetIterator,FilteredDocIdSetIterator
-
-