Class RoaringDocIdSet

  • All Implemented Interfaces:
    Accountable

    public class RoaringDocIdSet
    extends DocIdSet
    DocIdSet implementation 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 a FixedBitSet is used.

    • Field Detail

      • 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: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
      • iterator

        public DocIdSetIterator iterator()
                                  throws java.io.IOException
        Description copied from class: DocIdSet
        Provides a DocIdSetIterator to access the set. This implementation can return null if there are no docs that match.
        Specified by:
        iterator in class DocIdSet
        Throws:
        java.io.IOException
      • cardinality

        public int cardinality()
        Return the exact number of documents that are contained in this set.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object