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 TermStates for this term.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionSTBlockWriter(IndexOutput blockOutput, int targetNumBlockLines, int deltaNumLines, BlockEncoder blockEncoder) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLine(BytesRef term, List<FieldMetadataTermState> termStates, IndexDictionary.Builder dictionaryBuilder) Adds a newBlockLineterm for the current field.protected BlockLine.Serializerprotected voidfinishLastBlock(IndexDictionary.Builder dictionaryBuilder) This method is called when there is no more term for the field.protected voidupdateFieldMetadata(long blockStartFP) updates the field metadata after all lines were written for the block.protected voidwriteBlockLine(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 newBlockLineterm 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. TheBytesRefinstance 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:BlockWriterThis 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 thisBlockWriterstate. Then thisBlockWritercan be used for another field.- Overrides:
finishLastBlockin classBlockWriter- Throws:
IOException
-
createBlockLineSerializer
- Overrides:
createBlockLineSerializerin classBlockWriter
-
writeBlockLine
protected void writeBlockLine(boolean isIncrementalEncodingSeed, BlockLine line, BlockLine previousLine) throws IOException - Overrides:
writeBlockLinein classBlockWriter- Throws:
IOException
-
updateFieldMetadata
protected void updateFieldMetadata(long blockStartFP) Description copied from class:BlockWriterupdates the field metadata after all lines were written for the block.- Overrides:
updateFieldMetadatain classBlockWriter
-