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
A DocIdSet contains a set of doc ids. Implementing classes must only implement
iterator()
to provide access to the set.-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbits()
Optionally provides aBits
interface for random access to matching documents.abstract DocIdSetIterator
iterator()
Provides aDocIdSetIterator
to 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 Details
-
EMPTY
An emptyDocIdSet
instance
-
-
Constructor Details
-
DocIdSet
public DocIdSet()
-
-
Method Details
-
iterator
Provides aDocIdSetIterator
to access the set. This implementation can returnnull
if there are no docs that match.- Throws:
IOException
-
bits
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:
IOException
-