public class STBlockWriter extends BlockWriter
As defined in STUniformSplitTermsWriter
, all the fields terms are
shared in the same dictionary. Each block line contains a term and all the
fields TermState
s for this term.
Modifier and Type | Field and Description |
---|---|
protected Set<FieldMetadata> |
fieldsInBlock |
blockEncoder, blockHeaderWriter, blockLines, blockLinesWriteBuffer, blockLineWriter, blockOutput, blockWriteBuffer, deltaNumLines, fieldMetadata, lastTerm, reusableBlockHeader, scratchBytesRef, targetNumBlockLines, termStateSerializer, termStatesWriteBuffer
Constructor and Description |
---|
STBlockWriter(IndexOutput blockOutput,
int targetNumBlockLines,
int deltaNumLines,
BlockEncoder blockEncoder) |
Modifier and Type | Method and Description |
---|---|
void |
addLine(BytesRef term,
List<FieldMetadataTermState> termStates,
IndexDictionary.Builder dictionaryBuilder)
Adds a new
BlockLine term for the current field. |
protected BlockLine.Serializer |
createBlockLineSerializer() |
protected void |
finishLastBlock(IndexDictionary.Builder dictionaryBuilder)
This method is called when there is no more term for the field.
|
protected void |
updateFieldMetadata(long blockStartFP)
updates the field metadata after all lines were written for the block.
|
protected void |
writeBlockLine(boolean isIncrementalEncodingSeed,
BlockLine line,
BlockLine previousLine) |
addBlockKey, addLine, createBlockHeaderSerializer, createDeltaBaseTermStateSerializer, splitAndWriteBlock, writeBlock
protected final Set<FieldMetadata> fieldsInBlock
public STBlockWriter(IndexOutput blockOutput, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder)
public void addLine(BytesRef term, List<FieldMetadataTermState> termStates, IndexDictionary.Builder dictionaryBuilder) throws IOException
BlockLine
term for the current field.
This method determines whether the new term is part of the current block,
or if it is part of the next block. In the latter case, a new block is started
(including one or more of the lastly added lines), the current block is
written to the block file, and the current block key is added to the
IndexDictionary.Builder
.
term
- The block line term. The BytesRef
instance is used directly,
the caller is responsible to make a deep copy if needed. This is required
because we keep a list of block lines until we decide to write the
current block, and each line must have a different term instance.termStates
- Block line details for all fields in the line.dictionaryBuilder
- to which the block keys are added.IOException
protected void finishLastBlock(IndexDictionary.Builder dictionaryBuilder) throws IOException
BlockWriter
BlockWriter.addLine(org.apache.lucene.util.BytesRef, org.apache.lucene.codecs.BlockTermState, org.apache.lucene.codecs.uniformsplit.IndexDictionary.Builder)
as the last block of the
field and resets this BlockWriter
state. Then this BlockWriter
can be used for another field.finishLastBlock
in class BlockWriter
IOException
protected BlockLine.Serializer createBlockLineSerializer()
createBlockLineSerializer
in class BlockWriter
protected void writeBlockLine(boolean isIncrementalEncodingSeed, BlockLine line, BlockLine previousLine) throws IOException
writeBlockLine
in class BlockWriter
IOException
protected void updateFieldMetadata(long blockStartFP)
BlockWriter
updateFieldMetadata
in class BlockWriter
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.