Class STBlockWriter
java.lang.Object
org.apache.lucene.codecs.uniformsplit.BlockWriter
org.apache.lucene.codecs.uniformsplit.sharedterms.STBlockWriter
Writes terms blocks with the Shared Terms format.
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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from class org.apache.lucene.codecs.uniformsplit.BlockWriter
blockEncoder, blockHeaderWriter, blockLines, blockLinesWriteBuffer, blockLineWriter, blockOutput, blockWriteBuffer, deltaNumLines, fieldMetadata, lastTerm, reusableBlockHeader, scratchBytesRef, targetNumBlockLines, termStateSerializer, termStatesWriteBuffer
-
Constructor Summary
ConstructorDescriptionSTBlockWriter
(IndexOutput blockOutput, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLine
(BytesRef term, List<FieldMetadataTermState> termStates, IndexDictionary.Builder dictionaryBuilder) Adds a newBlockLine
term for the current field.protected BlockLine.Serializer
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) Methods inherited from class org.apache.lucene.codecs.uniformsplit.BlockWriter
addBlockKey, addLine, createBlockHeaderSerializer, createDeltaBaseTermStateSerializer, splitAndWriteBlock, writeBlock
-
Field Details
-
fieldsInBlock
-
-
Constructor Details
-
STBlockWriter
public STBlockWriter(IndexOutput blockOutput, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder)
-
-
Method Details
-
addLine
public void addLine(BytesRef term, List<FieldMetadataTermState> termStates, IndexDictionary.Builder dictionaryBuilder) throws IOException Adds a newBlockLine
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
.- Parameters:
term
- The block line term. TheBytesRef
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.- Throws:
IOException
-
finishLastBlock
Description copied from class:BlockWriter
This method is called when there is no more term for the field. It writes the remaining lines added withBlockWriter.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 thisBlockWriter
state. Then thisBlockWriter
can be used for another field.- Overrides:
finishLastBlock
in classBlockWriter
- Throws:
IOException
-
createBlockLineSerializer
- Overrides:
createBlockLineSerializer
in classBlockWriter
-
writeBlockLine
protected void writeBlockLine(boolean isIncrementalEncodingSeed, BlockLine line, BlockLine previousLine) throws IOException - Overrides:
writeBlockLine
in classBlockWriter
- Throws:
IOException
-
updateFieldMetadata
protected void updateFieldMetadata(long blockStartFP) Description copied from class:BlockWriter
updates the field metadata after all lines were written for the block.- Overrides:
updateFieldMetadata
in classBlockWriter
-