Package org.apache.lucene.codecs
Class MultiLevelSkipListReader
- java.lang.Object
-
- org.apache.lucene.codecs.MultiLevelSkipListReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
Lucene40SkipListReader
public abstract class MultiLevelSkipListReader extends Object implements Closeable
This abstract class reads skip lists with multiple levels. SeeMultiLevelSkipListWriter
for the information about the encoding of the multi level skip lists. Subclasses must implement the abstract methodreadSkipData(int, IndexInput)
which defines the actual format of the skip data.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
maxNumberOfSkipLevels
the maximum number of skip levels possible for this indexprotected int[]
skipDoc
Doc id of current skip entry per level.
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
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 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.
-
-
-
Constructor Detail
-
MultiLevelSkipListReader
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier)
Creates aMultiLevelSkipListReader
.
-
MultiLevelSkipListReader
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval)
Creates aMultiLevelSkipListReader
, whereskipInterval
andskipMultiplier
are the same.
-
-
Method Detail
-
getDoc
public int getDoc()
Returns the id of the doc to which the last call ofskipTo(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
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
init
public void init(long skipPointer, int df)
Initializes the reader, for reuse on a new term.
-
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 fromskipStream
- 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
-
-