Class Lucene50SkipReader
- java.lang.Object
-
- org.apache.lucene.codecs.MultiLevelSkipListReader
-
- org.apache.lucene.codecs.lucene50.Lucene50SkipReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
Lucene50ScoreSkipReader
class Lucene50SkipReader extends MultiLevelSkipListReader
Implements the skip list reader for block postings format that stores positions and payloads. Although this skipper uses MultiLevelSkipListReader as an interface, its definition of skip position will be a little different. For example, when skipInterval = blockSize = 3, df = 2*skipInterval = 6, 0 1 2 3 4 5 d d d d d d (posting list) ^ ^ (skip point in MultiLeveSkipWriter) ^ (skip point in Lucene50SkipWriter) In this case, MultiLevelSkipListReader will use the last document as a skip point, while Lucene50SkipReader should assume no skip point will comes. If we use the interface directly in Lucene50SkipReader, it may silly try to read another skip data after the only skip point is loaded. To illustrate this, we can call skipTo(d[5]), since skip point d[3] has smaller docId, and numSkipped+blockSize== df, the MultiLevelSkipListReader will assume the skip list isn't exhausted yet, and try to load a non-existed skip point Therefore, we'll trim df before passing it to the interface. see trim(int)
-
-
Field Summary
Fields Modifier and Type Field Description private long[]docPointerprivate longlastDocPointerprivate intlastPayloadByteUptoprivate longlastPayPointerprivate intlastPosBufferUptoprivate longlastPosPointerprivate int[]payloadByteUptoprivate long[]payPointerprivate int[]posBufferUptoprivate long[]posPointerprivate intversion-
Fields inherited from class org.apache.lucene.codecs.MultiLevelSkipListReader
maxNumberOfSkipLevels, numberOfSkipLevels, skipDoc
-
-
Constructor Summary
Constructors Constructor Description Lucene50SkipReader(int version, IndexInput skipStream, int maxSkipLevels, boolean hasPos, boolean hasOffsets, boolean hasPayloads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetDocPointer()Returns the doc pointer of the doc to which the last call ofMultiLevelSkipListReader.skipTo(int)has skipped.intgetNextSkipDoc()intgetPayloadByteUpto()longgetPayPointer()intgetPosBufferUpto()longgetPosPointer()voidinit(long skipPointer, long docBasePointer, long posBasePointer, long payBasePointer, int df)protected voidreadImpacts(int level, IndexInput skipStream)protected intreadSkipData(int level, IndexInput skipStream)Subclasses must implement the actual skip data encoding in this method.protected voidseekChild(int level)Seeks the skip entry on the given levelprotected voidsetLastSkipData(int level)Copies the values of the last read skip entry on this levelprotected inttrim(int df)Trim original docFreq to tell skipReader read proper number of skip points.-
Methods inherited from class org.apache.lucene.codecs.MultiLevelSkipListReader
close, getDoc, init, skipTo
-
-
-
-
Field Detail
-
version
private final int version
-
docPointer
private long[] docPointer
-
posPointer
private long[] posPointer
-
payPointer
private long[] payPointer
-
posBufferUpto
private int[] posBufferUpto
-
payloadByteUpto
private int[] payloadByteUpto
-
lastPosPointer
private long lastPosPointer
-
lastPayPointer
private long lastPayPointer
-
lastPayloadByteUpto
private int lastPayloadByteUpto
-
lastDocPointer
private long lastDocPointer
-
lastPosBufferUpto
private int lastPosBufferUpto
-
-
Constructor Detail
-
Lucene50SkipReader
public Lucene50SkipReader(int version, IndexInput skipStream, int maxSkipLevels, boolean hasPos, boolean hasOffsets, boolean hasPayloads)
-
-
Method Detail
-
trim
protected int trim(int df)
Trim original docFreq to tell skipReader read proper number of skip points. Since our definition in Lucene50Skip* is a little different from MultiLevelSkip* This trimmed docFreq will prevent skipReader from: 1. silly reading a non-existed skip point after the last block boundary 2. moving into the vInt block
-
init
public void init(long skipPointer, long docBasePointer, long posBasePointer, long payBasePointer, int df) throws java.io.IOException- Throws:
java.io.IOException
-
getDocPointer
public long getDocPointer()
Returns the doc pointer of the doc to which the last call ofMultiLevelSkipListReader.skipTo(int)has skipped.
-
getPosPointer
public long getPosPointer()
-
getPosBufferUpto
public int getPosBufferUpto()
-
getPayPointer
public long getPayPointer()
-
getPayloadByteUpto
public int getPayloadByteUpto()
-
getNextSkipDoc
public int getNextSkipDoc()
-
seekChild
protected void seekChild(int level) throws java.io.IOExceptionDescription copied from class:MultiLevelSkipListReaderSeeks the skip entry on the given level- Overrides:
seekChildin classMultiLevelSkipListReader- Throws:
java.io.IOException
-
setLastSkipData
protected void setLastSkipData(int level)
Description copied from class:MultiLevelSkipListReaderCopies the values of the last read skip entry on this level- Overrides:
setLastSkipDatain classMultiLevelSkipListReader
-
readSkipData
protected int readSkipData(int level, IndexInput skipStream) throws java.io.IOExceptionDescription copied from class:MultiLevelSkipListReaderSubclasses must implement the actual skip data encoding in this method.- Specified by:
readSkipDatain classMultiLevelSkipListReader- Parameters:
level- the level skip data shall be read fromskipStream- the skip stream to read from- Throws:
java.io.IOException
-
readImpacts
protected void readImpacts(int level, IndexInput skipStream) throws java.io.IOException- Throws:
java.io.IOException
-
-