Package org.apache.lucene.search
Class DocIdSet
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- Direct Known Subclasses:
DocIdBitSet
,EliasFanoDocIdSet
,FieldCacheDocIdSet
,FilteredDocIdSet
,FixedBitSet
,OpenBitSet
,PForDeltaDocIdSet
,WAH8DocIdSet
public abstract class DocIdSet extends java.lang.Object
A DocIdSet contains a set of doc ids. Implementing classes must only implementiterator()
to provide access to the set.
-
-
Constructor Summary
Constructors Constructor Description DocIdSet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Bits
bits()
Optionally provides aBits
interface for random access to matching documents.boolean
isCacheable()
This method is a hint forCachingWrapperFilter
, if thisDocIdSet
should be cached without copying it.abstract DocIdSetIterator
iterator()
Provides aDocIdSetIterator
to access the set.
-
-
-
Method Detail
-
iterator
public abstract DocIdSetIterator iterator() throws java.io.IOException
Provides aDocIdSetIterator
to access the set. This implementation can returnnull
if there are no docs that match.- Throws:
java.io.IOException
-
bits
public Bits bits() throws java.io.IOException
Optionally provides aBits
interface for random access to matching documents.- Returns:
null
, if thisDocIdSet
does not support random access. In contrast toiterator()
, a return value ofnull
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 (asBits
interface cannot throwIOException
). This is generally true for bit sets likeFixedBitSet
, which return itself if they are used asDocIdSet
.- Throws:
java.io.IOException
-
isCacheable
public boolean isCacheable()
This method is a hint forCachingWrapperFilter
, if thisDocIdSet
should be cached without copying it. The default is to returnfalse
. If you have an ownDocIdSet
implementation that does its iteration very effective and fast without doing disk I/O, override this method and returntrue
.
-
-