Package org.apache.lucene.util
Class RoaringDocIdSet
- java.lang.Object
-
- org.apache.lucene.search.DocIdSet
-
- org.apache.lucene.util.RoaringDocIdSet
-
- All Implemented Interfaces:
Accountable
public class RoaringDocIdSet extends DocIdSet
DocIdSetimplementation inspired from http://roaringbitmap.org/ The space is divided into blocks of 2^16 bits and each block is encoded independently. In each block, if less than 2^12 bits are set, then documents are simply stored in a short[]. If more than 2^16-2^12 bits are set, then the inverse of the set is encoded in a simple short[]. Otherwise aFixedBitSetis used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRoaringDocIdSet.BuilderA builder ofRoaringDocIdSets.private classRoaringDocIdSet.Iteratorprivate static classRoaringDocIdSet.ShortArrayDocIdSetDocIdSetimplementation that can store documents up to 2^16-1 in a short[].
-
Field Summary
Fields Modifier and Type Field Description private static longBASE_RAM_BYTES_USEDprivate static intBLOCK_SIZEprivate intcardinalityprivate DocIdSet[]docIdSetsprivate static intMAX_ARRAY_LENGTHprivate longramBytesUsed-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRoaringDocIdSet(DocIdSet[] docIdSets, int cardinality)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcardinality()Return the exact number of documents that are contained in this set.DocIdSetIteratoriterator()Provides aDocIdSetIteratorto access the set.longramBytesUsed()Return the memory usage of this object in bytes.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
BLOCK_SIZE
private static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
MAX_ARRAY_LENGTH
private static final int MAX_ARRAY_LENGTH
- See Also:
- Constant Field Values
-
BASE_RAM_BYTES_USED
private static final long BASE_RAM_BYTES_USED
-
docIdSets
private final DocIdSet[] docIdSets
-
cardinality
private final int cardinality
-
ramBytesUsed
private final long ramBytesUsed
-
-
Constructor Detail
-
RoaringDocIdSet
private RoaringDocIdSet(DocIdSet[] docIdSets, int cardinality)
-
-
Method Detail
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.
-
iterator
public DocIdSetIterator iterator() throws java.io.IOException
Description copied from class:DocIdSetProvides aDocIdSetIteratorto access the set. This implementation can returnnullif there are no docs that match.
-
cardinality
public int cardinality()
Return the exact number of documents that are contained in this set.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-