Module org.apache.lucene.core
Class Lucene101PostingsWriter
java.lang.Object
org.apache.lucene.codecs.PostingsWriterBase
org.apache.lucene.codecs.PushPostingsWriterBase
org.apache.lucene.codecs.lucene101.Lucene101PostingsWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
Writer for
Lucene101PostingsFormat.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate int(package private) final int[]private int(package private) IndexOutputprivate long(package private) static final Lucene101PostingsFormat.IntBlockTermStateprivate booleanprivate final ForDeltaUtil(package private) final int[]private intprivate intprivate int(package private) Lucene101PostingsFormat.IntBlockTermStateprivate final CompetitiveImpactAccumulatorprivate intprivate longprivate longprivate final ByteBuffersDataOutputOutput for a single block.private final CompetitiveImpactAccumulatorprivate intprivate longprivate longprivate final ByteBuffersDataOutputOutput for groups of 32 blocks.private intprivate intprivate intprivate int(package private) IndexOutputprivate NumericDocValues(package private) final int[](package private) final int[]private byte[]private int(package private) final int[](package private) IndexOutputprivate longprivate final PForUtilprivate int(package private) final int[](package private) IndexOutputprivate longprivate final ByteBuffersDataOutputScratch output that we use to be able to prepend the encoded length, e.g.Fields inherited from class org.apache.lucene.codecs.PushPostingsWriterBase
fieldInfo, indexOptions, writeFreqs, writeOffsets, writePayloads, writePositions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPosition(int position, BytesRef payload, int startOffset, int endOffset) Add a new position and payload, and start/end offset.voidclose()voidencodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState _state, boolean absolute) Encode metadata as long[] and byte[].voidCalled when we are done adding positions and payloads for each doc.voidfinishTerm(BlockTermState _state) Called when we are done adding docs to this termprivate voidflushDocBlock(boolean finishTerm) voidinit(IndexOutput termsOut, SegmentWriteState state) Called once after startup, before any terms have been added.Return a newly created empty TermStatevoidSets the current field for writing, and returns the fixed length of long[] metadata (which is fixed per field), called when the writing switches to another field.voidstartDoc(int docID, int termDocFreq) Adds a new doc in this term.voidstartTerm(NumericDocValues norms) Start a new term.(package private) static voidwriteImpacts(Collection<Impact> impacts, DataOutput out) private void(package private) static voidwriteVInt15(DataOutput out, int v) Special vints that are encoded on 2 bytes if they require 15 bits or less.(package private) static voidwriteVLong15(DataOutput out, long v) Methods inherited from class org.apache.lucene.codecs.PushPostingsWriterBase
writeTerm
-
Field Details
-
EMPTY_STATE
-
metaOut
IndexOutput metaOut -
docOut
IndexOutput docOut -
posOut
IndexOutput posOut -
payOut
IndexOutput payOut -
lastState
-
docStartFP
private long docStartFP -
posStartFP
private long posStartFP -
payStartFP
private long payStartFP -
docDeltaBuffer
final int[] docDeltaBuffer -
freqBuffer
final int[] freqBuffer -
docBufferUpto
private int docBufferUpto -
posDeltaBuffer
final int[] posDeltaBuffer -
payloadLengthBuffer
final int[] payloadLengthBuffer -
offsetStartDeltaBuffer
final int[] offsetStartDeltaBuffer -
offsetLengthBuffer
final int[] offsetLengthBuffer -
posBufferUpto
private int posBufferUpto -
payloadBytes
private byte[] payloadBytes -
payloadByteUpto
private int payloadByteUpto -
level0LastDocID
private int level0LastDocID -
level0LastPosFP
private long level0LastPosFP -
level0LastPayFP
private long level0LastPayFP -
level1LastDocID
private int level1LastDocID -
level1LastPosFP
private long level1LastPosFP -
level1LastPayFP
private long level1LastPayFP -
docID
private int docID -
lastDocID
private int lastDocID -
lastPosition
private int lastPosition -
lastStartOffset
private int lastStartOffset -
docCount
private int docCount -
pforUtil
-
forDeltaUtil
-
fieldHasNorms
private boolean fieldHasNorms -
norms
-
level0FreqNormAccumulator
-
level1CompetitiveFreqNormAccumulator
-
maxNumImpactsAtLevel0
private int maxNumImpactsAtLevel0 -
maxImpactNumBytesAtLevel0
private int maxImpactNumBytesAtLevel0 -
maxNumImpactsAtLevel1
private int maxNumImpactsAtLevel1 -
maxImpactNumBytesAtLevel1
private int maxImpactNumBytesAtLevel1 -
scratchOutput
Scratch output that we use to be able to prepend the encoded length, e.g. impacts. -
level0Output
Output for a single block. This is useful to be able to prepend skip data before each block, which can only be computed once the block is encoded. The content is then typically copied tolevel1Output. -
level1Output
Output for groups of 32 blocks. This is useful to prepend skip data for these 32 blocks, which can only be done once we have encoded these 32 blocks. The content is then typically copied todocCount.
-
-
Constructor Details
-
Lucene101PostingsWriter
Sole constructor.- Throws:
IOException
-
-
Method Details
-
newTermState
Description copied from class:PushPostingsWriterBaseReturn a newly created empty TermState- Specified by:
newTermStatein classPushPostingsWriterBase
-
init
Description copied from class:PostingsWriterBaseCalled once after startup, before any terms have been added. Implementations typically write a header to the providedtermsOut.- Specified by:
initin classPostingsWriterBase- Throws:
IOException
-
setField
Description copied from class:PushPostingsWriterBaseSets the current field for writing, and returns the fixed length of long[] metadata (which is fixed per field), called when the writing switches to another field.- Overrides:
setFieldin classPushPostingsWriterBase
-
startTerm
Description copied from class:PushPostingsWriterBaseStart a new term. Note that a matching call toPushPostingsWriterBase.finishTerm(BlockTermState)is done, only if the term has at least one document.- Specified by:
startTermin classPushPostingsWriterBase
-
startDoc
Description copied from class:PushPostingsWriterBaseAdds a new doc in this term.freqwill be -1 when term frequencies are omitted for the field.- Specified by:
startDocin classPushPostingsWriterBase- Throws:
IOException
-
addPosition
public void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws IOException Description copied from class:PushPostingsWriterBaseAdd a new position and payload, and start/end offset. A null payload means no payload; a non-null payload with zero length also means no payload. Caller may reuse theBytesReffor the payload between calls (method must fully consume the payload).startOffsetandendOffsetwill be -1 when offsets are not indexed.- Specified by:
addPositionin classPushPostingsWriterBase- Throws:
IOException
-
finishDoc
public void finishDoc()Description copied from class:PushPostingsWriterBaseCalled when we are done adding positions and payloads for each doc.- Specified by:
finishDocin classPushPostingsWriterBase
-
writeVInt15
Special vints that are encoded on 2 bytes if they require 15 bits or less. VInt becomes especially slow when the number of bytes is variable, so this special layout helps in the case when the number likely requires 15 bits or less- Throws:
IOException
-
writeVLong15
- Throws:
IOException- See Also:
-
flushDocBlock
- Throws:
IOException
-
writeLevel1SkipData
- Throws:
IOException
-
writeImpacts
- Throws:
IOException
-
finishTerm
Called when we are done adding docs to this term- Specified by:
finishTermin classPushPostingsWriterBase- Throws:
IOException
-
encodeTerm
public void encodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState _state, boolean absolute) throws IOException Description copied from class:PostingsWriterBaseEncode metadata as long[] and byte[].absolutecontrols whether current term is delta encoded according to latest term. Usually elements inlongsare file pointers, so each one always increases when a new term is consumed.outis used to write generic bytes, which are not monotonic.- Specified by:
encodeTermin classPostingsWriterBase- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classPostingsWriterBase- Throws:
IOException
-