Module org.apache.lucene.codecs
Class DeltaBaseTermStateSerializer
java.lang.Object
org.apache.lucene.codecs.uniformsplit.DeltaBaseTermStateSerializer
- All Implemented Interfaces:
Accountable
TermState serializer which encodes each file pointer as a delta relative to a base file
pointer. It differs from Lucene99PostingsWriter.encodeTerm(org.apache.lucene.store.DataOutput, org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.BlockTermState, boolean) which encodes each file
pointer as a delta relative to the previous file pointer.
It automatically sets the base file pointer to the first valid file pointer for doc start FP,
pos start FP, pay start FP. These base file pointers have to be reset
by the caller before starting to write a new block.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected longprotected longprivate static final longprivate static final longFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglonglonglongReturn the memory usage of this object in bytes.static longramBytesUsed(TermState termState) readTermState(long baseDocStartFP, long basePosStartFP, long basePayStartFP, DataInput termStatesInput, FieldInfo fieldInfo, BlockTermState reuse) Reads aBlockTermStatefrom the providedDataInput.protected Lucene99PostingsFormat.IntBlockTermStatereset(Lucene99PostingsFormat.IntBlockTermState termState) voidResets the base file pointers to 0.voidwriteTermState(DataOutput termStatesOutput, FieldInfo fieldInfo, BlockTermState termState) Writes aBlockTermStateto the providedDataOutput.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Field Details
-
RAM_USAGE
private static final long RAM_USAGE -
INT_BLOCK_TERM_STATE_RAM_USAGE
private static final long INT_BLOCK_TERM_STATE_RAM_USAGE -
baseDocStartFP
protected long baseDocStartFP -
basePosStartFP
protected long basePosStartFP -
basePayStartFP
protected long basePayStartFP
-
-
Constructor Details
-
DeltaBaseTermStateSerializer
public DeltaBaseTermStateSerializer()
-
-
Method Details
-
resetBaseStartFP
public void resetBaseStartFP()Resets the base file pointers to 0. This method has to be called before starting to write a new block. -
getBaseDocStartFP
public long getBaseDocStartFP()- Returns:
- The base doc start file pointer. It is the file pointer of the first
TermStatewritten afterresetBaseStartFP()is called.
-
getBasePosStartFP
public long getBasePosStartFP()- Returns:
- The base position start file pointer. It is the file pointer of the first
TermStatewritten afterresetBaseStartFP()is called.
-
getBasePayStartFP
public long getBasePayStartFP()- Returns:
- The base payload start file pointer. It is the file pointer of the first
TermStatewritten afterresetBaseStartFP()is called.
-
writeTermState
public void writeTermState(DataOutput termStatesOutput, FieldInfo fieldInfo, BlockTermState termState) throws IOException Writes aBlockTermStateto the providedDataOutput.Simpler variant of
Lucene99PostingsWriter.encodeTerm(DataOutput, FieldInfo, BlockTermState, boolean).- Throws:
IOException
-
readTermState
public BlockTermState readTermState(long baseDocStartFP, long basePosStartFP, long basePayStartFP, DataInput termStatesInput, FieldInfo fieldInfo, BlockTermState reuse) throws IOException Reads aBlockTermStatefrom the providedDataInput.Simpler variant of
Lucene99PostingsReader.decodeTerm(DataInput, FieldInfo, BlockTermState, boolean).- Parameters:
reuse-BlockTermStateto reuse; or null to create a new one.- Throws:
IOException
-
reset
protected Lucene99PostingsFormat.IntBlockTermState reset(Lucene99PostingsFormat.IntBlockTermState termState) -
ramBytesUsed
public long ramBytesUsed()Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
ramBytesUsed
- Returns:
- The estimated RAM usage of the given
TermState.
-