Class MultiLevelSkipListReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public abstract class MultiLevelSkipListReader
    extends Object
    implements Closeable
    This abstract class reads skip lists with multiple levels.

    See MultiLevelSkipListWriter for the information about the encoding of the multi level skip lists.

    Subclasses must implement the abstract method readSkipData(int, IndexInput) which defines the actual format of the skip data.

    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Field Detail

      • maxNumberOfSkipLevels

        protected int maxNumberOfSkipLevels
        the maximum number of skip levels possible for this index
      • numberOfSkipLevels

        protected int numberOfSkipLevels
        number of levels in this skip list
      • skipDoc

        protected int[] skipDoc
        Doc id of current skip entry per level.
    • Constructor Detail

      • MultiLevelSkipListReader

        protected MultiLevelSkipListReader​(IndexInput skipStream,
                                           int maxSkipLevels,
                                           int skipInterval,
                                           int skipMultiplier)
        Creates a MultiLevelSkipListReader.
      • MultiLevelSkipListReader

        protected MultiLevelSkipListReader​(IndexInput skipStream,
                                           int maxSkipLevels,
                                           int skipInterval)
        Creates a MultiLevelSkipListReader, where skipInterval and skipMultiplier are the same.
    • Method Detail

      • getDoc

        public int getDoc()
        Returns the id of the doc to which the last call of skipTo(int) has skipped.
      • skipTo

        public int skipTo​(int target)
                   throws IOException
        Skips entries to the first beyond the current whose document number is greater than or equal to target. Returns the current doc count.
        Throws:
        IOException
      • seekChild

        protected void seekChild​(int level)
                          throws IOException
        Seeks the skip entry on the given level
        Throws:
        IOException
      • init

        public void init​(long skipPointer,
                         int df)
                  throws IOException
        Initializes the reader, for reuse on a new term.
        Throws:
        IOException
      • readSkipData

        protected abstract int readSkipData​(int level,
                                            IndexInput skipStream)
                                     throws IOException
        Subclasses must implement the actual skip data encoding in this method.
        Parameters:
        level - the level skip data shall be read from
        skipStream - the skip stream to read from
        Throws:
        IOException
      • setLastSkipData

        protected void setLastSkipData​(int level)
        Copies the values of the last read skip entry on this level