Class DocIdBitSet

  • All Implemented Interfaces:
    Bits

    public class DocIdBitSet
    extends DocIdSet
    implements Bits
    Simple DocIdSet and DocIdSetIterator backed by a BitSet
    • Constructor Detail

      • DocIdBitSet

        public DocIdBitSet​(BitSet bitSet)
    • Method Detail

      • 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 itself 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)
        Description copied from interface: Bits
        Returns the value of the bit with the specified index.
        Specified by:
        get in interface Bits
        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.
      • length

        public int length()
        Description copied from interface: Bits
        Returns the number of bits in this set
        Specified by:
        length in interface Bits