Package org.apache.lucene.index
Class FieldInvertState
- java.lang.Object
-
- org.apache.lucene.index.FieldInvertState
-
public final class FieldInvertState extends java.lang.ObjectThis class tracks the number and position / offset parameters of terms being added to the index. The information collected in this class is also used to calculate the normalization factor for a field.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AttributeSourceattributeSource(package private) intindexCreatedVersionMajor(package private) IndexOptionsindexOptions(package private) intlastPosition(package private) intlastStartOffset(package private) intlength(package private) intmaxTermFrequency(package private) java.lang.Stringname(package private) intnumOverlap(package private) intoffset(package private) OffsetAttributeoffsetAttribute(package private) PayloadAttributepayloadAttribute(package private) PositionIncrementAttributeposIncrAttribute(package private) intposition(package private) TermToBytesRefAttributetermAttribute(package private) TermFrequencyAttributetermFreqAttribute(package private) intuniqueTermCount
-
Constructor Summary
Constructors Constructor Description FieldInvertState(int indexCreatedVersionMajor, java.lang.String name, IndexOptions indexOptions)Creates {code FieldInvertState} for the specified field name.FieldInvertState(int indexCreatedVersionMajor, java.lang.String name, IndexOptions indexOptions, int position, int length, int numOverlap, int offset, int maxTermFrequency, int uniqueTermCount)Creates {code FieldInvertState} for the specified field name and values for all fields.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeSourcegetAttributeSource()Returns theAttributeSourcefrom theTokenStreamthat provided the indexed tokens for this field.intgetIndexCreatedVersionMajor()Return the version that was used to create the index, or 6 if it was created before 7.0.IndexOptionsgetIndexOptions()Get the index options for this fieldintgetLength()Get total number of terms in this field.intgetMaxTermFrequency()Get the maximum term-frequency encountered for any term in the field.java.lang.StringgetName()Return the field's nameintgetNumOverlap()Get the number of terms withpositionIncrement == 0.intgetOffset()Get end offset of the last processed term.intgetPosition()Get the last processed term position.intgetUniqueTermCount()Return the number of unique terms encountered in this field.(package private) voidreset()Re-initialize the state(package private) voidsetAttributeSource(AttributeSource attributeSource)Sets attributeSource to a new instance.voidsetLength(int length)Set length value.voidsetNumOverlap(int numOverlap)Set number of terms withpositionIncrement == 0.
-
-
-
Field Detail
-
indexCreatedVersionMajor
final int indexCreatedVersionMajor
-
name
final java.lang.String name
-
indexOptions
final IndexOptions indexOptions
-
position
int position
-
length
int length
-
numOverlap
int numOverlap
-
offset
int offset
-
maxTermFrequency
int maxTermFrequency
-
uniqueTermCount
int uniqueTermCount
-
lastStartOffset
int lastStartOffset
-
lastPosition
int lastPosition
-
attributeSource
AttributeSource attributeSource
-
offsetAttribute
OffsetAttribute offsetAttribute
-
posIncrAttribute
PositionIncrementAttribute posIncrAttribute
-
payloadAttribute
PayloadAttribute payloadAttribute
-
termAttribute
TermToBytesRefAttribute termAttribute
-
termFreqAttribute
TermFrequencyAttribute termFreqAttribute
-
-
Constructor Detail
-
FieldInvertState
public FieldInvertState(int indexCreatedVersionMajor, java.lang.String name, IndexOptions indexOptions)Creates {code FieldInvertState} for the specified field name.
-
FieldInvertState
public FieldInvertState(int indexCreatedVersionMajor, java.lang.String name, IndexOptions indexOptions, int position, int length, int numOverlap, int offset, int maxTermFrequency, int uniqueTermCount)Creates {code FieldInvertState} for the specified field name and values for all fields.
-
-
Method Detail
-
reset
void reset()
Re-initialize the state
-
setAttributeSource
void setAttributeSource(AttributeSource attributeSource)
Sets attributeSource to a new instance.
-
getPosition
public int getPosition()
Get the last processed term position.- Returns:
- the position
-
getLength
public int getLength()
Get total number of terms in this field.- Returns:
- the length
-
setLength
public void setLength(int length)
Set length value.
-
getNumOverlap
public int getNumOverlap()
Get the number of terms withpositionIncrement == 0.- Returns:
- the numOverlap
-
setNumOverlap
public void setNumOverlap(int numOverlap)
Set number of terms withpositionIncrement == 0.
-
getOffset
public int getOffset()
Get end offset of the last processed term.- Returns:
- the offset
-
getMaxTermFrequency
public int getMaxTermFrequency()
Get the maximum term-frequency encountered for any term in the field. A field containing "the quick brown fox jumps over the lazy dog" would have a value of 2, because "the" appears twice.
-
getUniqueTermCount
public int getUniqueTermCount()
Return the number of unique terms encountered in this field.
-
getAttributeSource
public AttributeSource getAttributeSource()
Returns theAttributeSourcefrom theTokenStreamthat provided the indexed tokens for this field.
-
getName
public java.lang.String getName()
Return the field's name
-
getIndexCreatedVersionMajor
public int getIndexCreatedVersionMajor()
Return the version that was used to create the index, or 6 if it was created before 7.0.
-
getIndexOptions
public IndexOptions getIndexOptions()
Get the index options for this field
-
-