Package org.apache.lucene.util
Class DocIdBitSet
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- org.apache.lucene.util.DocIdBitSet
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.lucene.util.Bits
Bits.MatchAllBits, Bits.MatchNoBits
-
-
Field Summary
-
Fields inherited from interface org.apache.lucene.util.Bits
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description DocIdBitSet(BitSet bitSet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bits
bits()
Optionally provides aBits
interface for random access to matching documents.boolean
get(int index)
Returns the value of the bit with the specifiedindex
.BitSet
getBitSet()
Returns the underlying BitSet.boolean
isCacheable()
This DocIdSet implementation is cacheable.DocIdSetIterator
iterator()
Provides aDocIdSetIterator
to access the set.int
length()
Returns the number of bits in this set
-
-
-
Constructor Detail
-
DocIdBitSet
public DocIdBitSet(BitSet bitSet)
-
-
Method Detail
-
iterator
public DocIdSetIterator iterator()
Description copied from class:DocIdSet
Provides aDocIdSetIterator
to access the set. This implementation can returnnull
if there are no docs that match.
-
bits
public Bits bits()
Description copied from class:DocIdSet
Optionally provides aBits
interface for random access to matching documents.- Overrides:
bits
in classDocIdSet
- Returns:
null
, if thisDocIdSet
does not support random access. In contrast toDocIdSet.iterator()
, 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
.
-
isCacheable
public boolean isCacheable()
This DocIdSet implementation is cacheable.- Overrides:
isCacheable
in classDocIdSet
-
getBitSet
public BitSet getBitSet()
Returns the underlying BitSet.
-
get
public boolean get(int index)
Description copied from interface:Bits
Returns the value of the bit with the specifiedindex
.- Specified by:
get
in interfaceBits
- Parameters:
index
- index, should be non-negative and <Bits.length()
. The result of passing negative or out of bounds values is undefined by this interface, just don't do it!- Returns:
true
if the bit is set,false
otherwise.
-
-