public abstract class MultiLevelSkipListReader
extends java.lang.Object
implements java.io.Closeable
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.Modifier and Type | Class and Description |
---|---|
private static class |
MultiLevelSkipListReader.SkipBuffer
used to buffer the top skip levels
|
Modifier and Type | Field and Description |
---|---|
private long[] |
childPointer
Child pointer of current skip entry per level.
|
private int |
docCount |
private boolean |
inputIsBuffered |
private long |
lastChildPointer
childPointer of last read skip entry with docId <=
target.
|
private int |
lastDoc
Doc id of last read skip entry with docId <= target.
|
protected int |
maxNumberOfSkipLevels
the maximum number of skip levels possible for this index
|
private int |
numberOfLevelsToBuffer |
protected int |
numberOfSkipLevels
number of levels in this skip list
|
private int[] |
numSkipped
Number of docs skipped per level.
|
protected int[] |
skipDoc
Doc id of current skip entry per level.
|
private int[] |
skipInterval
skipInterval of each level.
|
private int |
skipMultiplier |
private long[] |
skipPointer
The start pointer of each skip level.
|
private IndexInput[] |
skipStream
skipStream for each level.
|
Modifier | Constructor and Description |
---|---|
protected |
MultiLevelSkipListReader(IndexInput skipStream,
int maxSkipLevels,
int skipInterval)
Creates a
MultiLevelSkipListReader , where
skipInterval and skipMultiplier are
the same. |
protected |
MultiLevelSkipListReader(IndexInput skipStream,
int maxSkipLevels,
int skipInterval,
int skipMultiplier)
Creates a
MultiLevelSkipListReader . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
getDoc()
Returns the id of the doc to which the last call of
skipTo(int)
has skipped. |
void |
init(long skipPointer,
int df)
Initializes the reader, for reuse on a new term.
|
private boolean |
loadNextSkip(int level) |
private void |
loadSkipLevels()
Loads the skip levels
|
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 level
|
protected void |
setLastSkipData(int level)
Copies the values of the last read skip entry on this level
|
int |
skipTo(int target)
Skips entries to the first beyond the current whose document number is
greater than or equal to target.
|
protected int maxNumberOfSkipLevels
protected int numberOfSkipLevels
private int numberOfLevelsToBuffer
private int docCount
private IndexInput[] skipStream
private long[] skipPointer
private int[] skipInterval
private int[] numSkipped
protected int[] skipDoc
private int lastDoc
private long[] childPointer
private long lastChildPointer
private boolean inputIsBuffered
private final int skipMultiplier
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier)
MultiLevelSkipListReader
.protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval)
MultiLevelSkipListReader
, where
skipInterval
and skipMultiplier
are
the same.public int getDoc()
skipTo(int)
has skipped.public int skipTo(int target) throws java.io.IOException
java.io.IOException
private boolean loadNextSkip(int level) throws java.io.IOException
java.io.IOException
protected void seekChild(int level) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void init(long skipPointer, int df) throws java.io.IOException
java.io.IOException
private void loadSkipLevels() throws java.io.IOException
java.io.IOException
protected abstract int readSkipData(int level, IndexInput skipStream) throws java.io.IOException
level
- the level skip data shall be read fromskipStream
- the skip stream to read fromjava.io.IOException
protected void setLastSkipData(int level)