org.apache.lucene.util
Class DocIdBitSet
java.lang.Object
org.apache.lucene.search.DocIdSet
org.apache.lucene.util.DocIdBitSet
- All Implemented Interfaces:
- Bits
public class DocIdBitSet
- extends DocIdSet
- implements Bits
Simple DocIdSet and DocIdSetIterator backed by a BitSet
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocIdBitSet
public DocIdBitSet(BitSet bitSet)
iterator
public DocIdSetIterator iterator()
- Description copied from class:
DocIdSet
- Provides a
DocIdSetIterator
to access the set.
This implementation can return null
or
DocIdSet.EMPTY_DOCIDSET.iterator()
if there
are no docs that match.
- Specified by:
iterator
in class DocIdSet
bits
public Bits bits()
- Description copied from class:
DocIdSet
- Optionally provides a
Bits
interface for random access
to matching documents.
- Overrides:
bits
in class DocIdSet
- Returns:
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
itsself if they are used as DocIdSet
.
isCacheable
public boolean isCacheable()
- This DocIdSet implementation is cacheable.
- Overrides:
isCacheable
in class DocIdSet
getBitSet
public BitSet getBitSet()
- Returns the underlying BitSet.
get
public boolean get(int index)
- Specified by:
get
in interface Bits
length
public int length()
- Specified by:
length
in interface Bits
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.