Class FieldMetadata
- java.lang.Object
-
- org.apache.lucene.codecs.uniformsplit.FieldMetadata
-
- All Implemented Interfaces:
Accountable
public class FieldMetadata extends java.lang.Object implements Accountable
Metadata and stats for one field in the index.There is only one instance of
FieldMetadata
perFieldInfo
.
-
-
Field Summary
Fields Modifier and Type Field Description private static long
BASE_RAM_USAGE
protected long
dictionaryStartFP
protected int
docCount
protected FixedBitSet
docsSeen
protected FieldInfo
fieldInfo
protected long
firstBlockStartFP
protected boolean
isMutable
protected long
lastBlockStartFP
protected BytesRef
lastTerm
protected int
numTerms
protected int
sumDocFreq
protected int
sumTotalTermFreq
-
Constructor Summary
Constructors Constructor Description FieldMetadata(FieldInfo fieldInfo, int maxDoc)
Constructs aFieldMetadata
used for writing the index.FieldMetadata(FieldInfo fieldInfo, int maxDoc, boolean isMutable)
FieldMetadata(FieldInfo fieldInfo, int maxDoc, boolean isMutable, long firstBlockStartFP, long lastBlockStartFP, BytesRef lastTerm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getDictionaryStartFP()
int
getDocCount()
FixedBitSet
getDocsSeen()
Provides theFixedBitSet
to keep track of the docs seen when callingPostingsWriterBase.writeTerm(BytesRef, TermsEnum, FixedBitSet, org.apache.lucene.codecs.NormsProducer)
.FieldInfo
getFieldInfo()
long
getFirstBlockStartFP()
long
getLastBlockStartFP()
BytesRef
getLastTerm()
int
getNumTerms()
int
getSumDocFreq()
int
getSumTotalTermFreq()
long
ramBytesUsed()
Return the memory usage of this object in bytes.static FieldMetadata
read(DataInput input, FieldInfos fieldInfos)
void
setDictionaryStartFP(long dictionaryStartFP)
Sets the file pointer to the start of the dictionary of the field.void
setFirstBlockStartFP(long firstBlockStartFP)
Sets the file pointer to the start of the first block of the field.void
setLastBlockStartFP(long lastBlockStartFP)
Sets the file pointer after the end of the last block of the field.void
setLastTerm(BytesRef lastTerm)
void
updateStats(BlockTermState state)
Updates the field stats with the givenBlockTermState
for the current block line (for one term).void
write(DataOutput output)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
BASE_RAM_USAGE
private static final long BASE_RAM_USAGE
-
fieldInfo
protected final FieldInfo fieldInfo
-
isMutable
protected final boolean isMutable
-
docsSeen
protected final FixedBitSet docsSeen
-
sumDocFreq
protected int sumDocFreq
-
numTerms
protected int numTerms
-
sumTotalTermFreq
protected int sumTotalTermFreq
-
docCount
protected int docCount
-
dictionaryStartFP
protected long dictionaryStartFP
-
firstBlockStartFP
protected long firstBlockStartFP
-
lastBlockStartFP
protected long lastBlockStartFP
-
lastTerm
protected BytesRef lastTerm
-
-
Constructor Detail
-
FieldMetadata
public FieldMetadata(FieldInfo fieldInfo, int maxDoc)
Constructs aFieldMetadata
used for writing the index. ThisFieldMetadata
is mutable.- Parameters:
maxDoc
- The total number of documents in the segment being written.
-
FieldMetadata
public FieldMetadata(FieldInfo fieldInfo, int maxDoc, boolean isMutable)
-
-
Method Detail
-
updateStats
public void updateStats(BlockTermState state)
Updates the field stats with the givenBlockTermState
for the current block line (for one term).
-
getDocsSeen
public FixedBitSet getDocsSeen()
Provides theFixedBitSet
to keep track of the docs seen when callingPostingsWriterBase.writeTerm(BytesRef, TermsEnum, FixedBitSet, org.apache.lucene.codecs.NormsProducer)
.The returned
FixedBitSet
is created once in thisFieldMetadata
constructor.- Returns:
- The
FixedBitSet
for the docs seen, during segment writing; or null if thisFieldMetadata
is created immutable during segment reading.
-
getFieldInfo
public FieldInfo getFieldInfo()
-
getSumDocFreq
public int getSumDocFreq()
-
getNumTerms
public int getNumTerms()
-
getSumTotalTermFreq
public int getSumTotalTermFreq()
-
getDocCount
public int getDocCount()
-
getFirstBlockStartFP
public long getFirstBlockStartFP()
- Returns:
- The file pointer to the start of the first block of the field.
-
setFirstBlockStartFP
public void setFirstBlockStartFP(long firstBlockStartFP)
Sets the file pointer to the start of the first block of the field.
-
getLastBlockStartFP
public long getLastBlockStartFP()
- Returns:
- The start file pointer for the last block of the field.
-
setLastBlockStartFP
public void setLastBlockStartFP(long lastBlockStartFP)
Sets the file pointer after the end of the last block of the field.
-
getDictionaryStartFP
public long getDictionaryStartFP()
- Returns:
- The file pointer to the start of the dictionary of the field.
-
setDictionaryStartFP
public void setDictionaryStartFP(long dictionaryStartFP)
Sets the file pointer to the start of the dictionary of the field.
-
setLastTerm
public void setLastTerm(BytesRef lastTerm)
-
getLastTerm
public BytesRef getLastTerm()
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
read
public static FieldMetadata read(DataInput input, FieldInfos fieldInfos) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write(DataOutput output) throws java.io.IOException
- Throws:
java.io.IOException
-
-