FieldMetadata (Lucene 10.5.0 codecs API)
Description: declaration: package: org.apache.lucene.codecs.uniformsplit, class: FieldMetadata

Package org.apache.lucene.codecs.uniformsplit

# Class FieldMetadata

java.lang.Object
org.apache.lucene.codecs.uniformsplit.FieldMetadata

public class FieldMetadata extends Object
Metadata and stats for one field in the index.

There is only one instance of `FieldMetadata` per `FieldInfo`.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `FieldMetadata.Serializer`
  Reads/writes field metadata.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `dictionaryStartFP`
  `protected int`
  `docCount`
  `protected final FixedBitSet`
  `docsSeen`
  `protected final FieldInfo`
  `fieldInfo`
  `protected long`
  `firstBlockStartFP`
  `protected final boolean`
  `isMutable`
  `protected long`
  `lastBlockStartFP`
  `protected BytesRef`
  `lastTerm`
  `protected long`
  `numTerms`
  `protected long`
  `sumDocFreq`
  `protected long`
  `sumTotalTermFreq`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `FieldMetadata(long dictionaryStartFP, long firstBlockStartFP, long lastBlockStartFP, BytesRef lastTerm)`
  Constructs immutable virtual field metadata for reading.
  ``
  `FieldMetadata(FieldInfo fieldInfo, int maxDoc)`
  Constructs field metadata for writing.
  `protected`
  `FieldMetadata(FieldInfo fieldInfo, int maxDoc, boolean isMutable)`
  Constructs field metadata for reading or writing.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getDictionaryStartFP()`
  `int`
  `getDocCount()`
  `FixedBitSet`
  `getDocsSeen()`
  Provides the `FixedBitSet` to keep track of the docs seen when calling `PostingsWriterBase.writeTerm(BytesRef, TermsEnum, FixedBitSet, org.apache.lucene.codecs.NormsProducer)`.
  `FieldInfo`
  `getFieldInfo()`
  `long`
  `getFirstBlockStartFP()`
  `long`
  `getLastBlockStartFP()`
  `BytesRef`
  `getLastTerm()`
  `long`
  `getNumTerms()`
  `long`
  `getSumDocFreq()`
  `long`
  `getSumTotalTermFreq()`
  `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 given `BlockTermState` for the current block line (for one term).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### fieldInfo

    protected final FieldInfo fieldInfo

  - ### isMutable

    protected final boolean isMutable

  - ### docsSeen

    protected final FixedBitSet docsSeen

  - ### sumDocFreq

    protected long sumDocFreq

  - ### numTerms

    protected long numTerms

  - ### sumTotalTermFreq

    protected long sumTotalTermFreq

  - ### docCount

    protected int docCount

  - ### dictionaryStartFP

    protected long dictionaryStartFP

  - ### firstBlockStartFP

    protected long firstBlockStartFP

  - ### lastBlockStartFP

    protected long lastBlockStartFP

  - ### lastTerm

    protected BytesRef lastTerm

- ## Constructor Details

  - ### FieldMetadata

    public FieldMetadata(FieldInfo fieldInfo, int maxDoc)
    Constructs field metadata for writing.
    Parameters:
      `maxDoc` - The total number of documents in the segment being written.

  - ### FieldMetadata

    public FieldMetadata(long dictionaryStartFP, long firstBlockStartFP, long lastBlockStartFP, BytesRef lastTerm)
    Constructs immutable virtual field metadata for reading.

  - ### FieldMetadata

    protected FieldMetadata(FieldInfo fieldInfo, int maxDoc, boolean isMutable)
    Constructs field metadata for reading or writing.
    Parameters:
      `maxDoc` - The total number of documents in the segment being written.
      `isMutable` - Set true if this FieldMetadata is created for writing the index. Set false if it is used for reading the index.

- ## Method Details

  - ### updateStats

    public void updateStats(BlockTermState state)
    Updates the field stats with the given `BlockTermState` for the current block line (for one term).

  - ### getDocsSeen

    public FixedBitSet getDocsSeen()
    Provides the `FixedBitSet` to keep track of the docs seen when calling `PostingsWriterBase.writeTerm(BytesRef, TermsEnum, FixedBitSet, org.apache.lucene.codecs.NormsProducer)`.

    The returned `FixedBitSet` is created once in this `FieldMetadata` constructor.

    Returns:
      The `FixedBitSet` for the docs seen, during segment writing; or null if this `FieldMetadata` is created immutable during segment reading.

  - ### getFieldInfo

    public FieldInfo getFieldInfo()

  - ### getSumDocFreq

    public long getSumDocFreq()

  - ### getNumTerms

    public long getNumTerms()

  - ### getSumTotalTermFreq

    public long 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()