Package org.apache.lucene.search
Class DocIdSet
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- All Implemented Interfaces:
Accountable
- Direct Known Subclasses:
BitDocIdSet,DocsWithFieldSet,NotDocIdSet,RoaringDocIdSet
public abstract class DocIdSet extends Object implements Accountable
A DocIdSet contains a set of doc ids. Implementing classes must only implementiterator()to provide access to the set.
-
-
Field Summary
Fields Modifier and Type Field Description static DocIdSetEMPTYAn emptyDocIdSetinstance-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description DocIdSet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DocIdSetall(int maxDoc)ADocIdSetthat matches all doc ids up to a specified doc (exclusive).Bitsbits()Optionally provides aBitsinterface for random access to matching documents.abstract DocIdSetIteratoriterator()Provides aDocIdSetIteratorto access the set.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsed
-
-
-
-
Field Detail
-
EMPTY
public static final DocIdSet EMPTY
An emptyDocIdSetinstance
-
-
Method Detail
-
all
public static DocIdSet all(int maxDoc)
ADocIdSetthat matches all doc ids up to a specified doc (exclusive).
-
iterator
public abstract DocIdSetIterator iterator() throws IOException
Provides aDocIdSetIteratorto access the set. This implementation can returnnullif there are no docs that match.- Throws:
IOException
-
bits
public Bits bits() throws IOException
Optionally provides aBitsinterface for random access to matching documents.- Returns:
null, if thisDocIdSetdoes not support random access. In contrast toiterator(), a return value ofnulldoes 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 (asBitsinterface cannot throwIOException). This is generally true for bit sets likeFixedBitSet, which return itself if they are used asDocIdSet.- Throws:
IOException
-
-