public abstract class FilteredDocIdSet extends DocIdSet
match(int)
method is invoked on-demand, per docID visited during
searching. If you know few docIDs will be visited, and
the logic behind match(int)
is relatively costly,
this may be a better way to filter than ChainedFilter.DocIdSet
Constructor and Description |
---|
FilteredDocIdSet(DocIdSet innerSet)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Bits |
bits()
Optionally provides a
Bits interface for random access
to matching documents. |
boolean |
isCacheable()
This DocIdSet implementation is cacheable if the inner set is cacheable.
|
DocIdSetIterator |
iterator()
Implementation of the contract to build a DocIdSetIterator.
|
protected abstract boolean |
match(int docid)
Validation method to determine whether a docid should be in the result set.
|
public FilteredDocIdSet(DocIdSet innerSet)
innerSet
- Underlying DocIdSetpublic boolean isCacheable()
isCacheable
in class DocIdSet
public Bits bits() throws IOException
DocIdSet
Bits
interface for random access
to matching documents.bits
in class DocIdSet
null
, if this DocIdSet
does not support random access.
In contrast to DocIdSet.iterator()
, a return value of null
does not imply that no documents match the filter!
The default implementation does not provide random access, so you
only need to implement this method if your DocIdSet can
guarantee random access to every docid in O(1) time without
external disk access (as Bits
interface cannot throw
IOException
). This is generally true for bit sets
like FixedBitSet
, which return
itself if they are used as DocIdSet
.IOException
protected abstract boolean match(int docid)
docid
- docid to be testedpublic DocIdSetIterator iterator() throws IOException
iterator
in class DocIdSet
IOException
DocIdSetIterator
,
FilteredDocIdSetIterator
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.