Package org.apache.lucene.codecs
Class MultiLevelSkipListReader
java.lang.Object
org.apache.lucene.codecs.MultiLevelSkipListReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
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 Summary
Modifier and TypeFieldDescriptionprotected int
the maximum number of skip levels possible for this indexprotected int
number of levels in this skip listprotected int[]
Doc id of current skip entry per level. -
Constructor Summary
ModifierConstructorDescriptionprotected
MultiLevelSkipListReader
(IndexInput skipStream, int maxSkipLevels, int skipInterval) Creates aMultiLevelSkipListReader
, whereskipInterval
andskipMultiplier
are the same.protected
MultiLevelSkipListReader
(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier) Creates aMultiLevelSkipListReader
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
getDoc()
Returns the id of the doc to which the last call ofskipTo(int)
has skipped.void
init
(long skipPointer, int df) Initializes the reader, for reuse on a new term.protected long
readChildPointer
(IndexInput skipStream) read the child pointer written viaMultiLevelSkipListWriter.writeChildPointer(long, DataOutput)
.protected long
readLevelLength
(IndexInput skipStream) read the length of the current level written viaMultiLevelSkipListWriter.writeLevelLength(long, IndexOutput)
.protected abstract int
readSkipData
(int level, IndexInput skipStream) Subclasses must implement the actual skip data encoding in this method.protected void
seekChild
(int level) Seeks the skip entry on the given levelprotected void
setLastSkipData
(int level) Copies the values of the last read skip entry on this levelint
skipTo
(int target) Skips entries to the first beyond the current whose document number is greater than or equal to target.
-
Field Details
-
maxNumberOfSkipLevels
protected int maxNumberOfSkipLevelsthe maximum number of skip levels possible for this index -
numberOfSkipLevels
protected int numberOfSkipLevelsnumber of levels in this skip list -
skipDoc
protected int[] skipDocDoc id of current skip entry per level.
-
-
Constructor Details
-
MultiLevelSkipListReader
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier) Creates aMultiLevelSkipListReader
. -
MultiLevelSkipListReader
Creates aMultiLevelSkipListReader
, whereskipInterval
andskipMultiplier
are the same.
-
-
Method Details
-
getDoc
public int getDoc()Returns the id of the doc to which the last call ofskipTo(int)
has skipped. -
skipTo
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
Seeks the skip entry on the given level- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
init
Initializes the reader, for reuse on a new term.- Throws:
IOException
-
readSkipData
Subclasses must implement the actual skip data encoding in this method.- Parameters:
level
- the level skip data shall be read fromskipStream
- the skip stream to read from- Throws:
IOException
-
readLevelLength
read the length of the current level written viaMultiLevelSkipListWriter.writeLevelLength(long, IndexOutput)
.- Parameters:
skipStream
- the IndexInput the length shall be read from- Returns:
- level length
- Throws:
IOException
-
readChildPointer
read the child pointer written viaMultiLevelSkipListWriter.writeChildPointer(long, DataOutput)
.- Parameters:
skipStream
- the IndexInput the child pointer shall be read from- Returns:
- child pointer
- Throws:
IOException
-
setLastSkipData
protected void setLastSkipData(int level) Copies the values of the last read skip entry on this level
-