FieldInfo (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.index, class: FieldInfo

Package org.apache.lucene.index

# Class FieldInfo

java.lang.Object
org.apache.lucene.index.FieldInfo

public final class FieldInfo extends Object
Access to the Field Info file that describes document fields and whether or not they are indexed. Each segment has a separate Field Info file. Objects of this class are thread-safe for multiple readers, but only one thread can be adding documents at a time, with no other reader or writer threads accessing this object.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final String`
  `name`
  Field's name
  `final int`
  `number`
  Internal field number

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, DocValuesSkipIndexType docValuesSkipIndex, long dvGen, Map<String,String> attributes, int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, int vectorDimension, VectorEncoding vectorEncoding, VectorSimilarityFunction vectorSimilarityFunction, boolean softDeletesField, boolean isParentField)`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<String,String>`
  `attributes()`
  Returns internal codec attributes map.
  `void`
  `checkConsistency()`
  Check correctness of the FieldInfo options
  `DocValuesSkipIndexType`
  `docValuesSkipIndexType()`
  Returns true if, and only if, this field has a skip index.
  `String`
  `getAttribute(String key)`
  Get a codec attribute value, or null if it does not exist
  `long`
  `getDocValuesGen()`
  Returns the docValues generation of this field, or -1 if no docValues updates exist for it.
  `DocValuesType`
  `getDocValuesType()`
  Returns `DocValuesType` of the docValues; this is `DocValuesType.NONE` if the field has no docvalues.
  `int`
  `getFieldNumber()`
  Returns the field number
  `IndexOptions`
  `getIndexOptions()`
  Returns IndexOptions for the field, or IndexOptions.NONE if the field is not indexed
  `String`
  `getName()`
  Returns name of this field
  `int`
  `getPointDimensionCount()`
  Return point data dimension count
  `int`
  `getPointIndexDimensionCount()`
  Return point data dimension count
  `int`
  `getPointNumBytes()`
  Return number of bytes per dimension
  `int`
  `getVectorDimension()`
  Returns the number of dimensions of the vector value
  `VectorEncoding`
  `getVectorEncoding()`
  Returns the number of dimensions of the vector value
  `VectorSimilarityFunction`
  `getVectorSimilarityFunction()`
  Returns `VectorSimilarityFunction` for the field
  `boolean`
  `hasNorms()`
  Returns true if this field actually has any norms.
  `boolean`
  `hasPayloads()`
  Returns true if any payloads exist for this field.
  `boolean`
  `hasTermVectors()`
  Returns true if any term vectors exist for this field.
  `boolean`
  `hasVectorValues()`
  Returns whether any (numeric) vector values exist for this field
  `boolean`
  `isParentField()`
  Returns true if this field is configured and used as the parent document field field.
  `boolean`
  `isSoftDeletesField()`
  Returns true if this field is configured and used as the soft-deletes field.
  `boolean`
  `isTermDocField()`
  Returns true if the field has custom term frequencies indexed that are to be treated as opaque values, while the term frequency for statistical and scoring purposes is treated as 1.
  `boolean`
  `omitsNorms()`
  Returns true if norms are explicitly omitted for this field
  `String`
  `putAttribute(String key, String value)`
  Puts a codec attribute value.
  `void`
  `setDocValuesType(DocValuesType type)`
  Record that this field is indexed with docvalues, with the specified type
  `void`
  `setOmitsNorms()`
  Omit norms for this field.
  `void`
  `setPointDimensions(int dimensionCount, int indexDimensionCount, int numBytes)`
  Record that this field is indexed with points, with the specified number of dimensions and bytes per dimension.

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

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

- ## Field Details

  - ### name

    public final String name
    Field's name

  - ### number

    public final int number
    Internal field number

- ## Constructor Details

  - ### FieldInfo

    public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, DocValuesSkipIndexType docValuesSkipIndex, long dvGen, Map<String,String> attributes, int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, int vectorDimension, VectorEncoding vectorEncoding, VectorSimilarityFunction vectorSimilarityFunction, boolean softDeletesField, boolean isParentField)
    Sole constructor.
    WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Method Details

  - ### checkConsistency

    public void checkConsistency()
    Check correctness of the FieldInfo options
    Throws:
      `IllegalArgumentException` - if some options are incorrect

  - ### setPointDimensions

    public void setPointDimensions(int dimensionCount, int indexDimensionCount, int numBytes)
    Record that this field is indexed with points, with the specified number of dimensions and bytes per dimension.

  - ### getPointDimensionCount

    public int getPointDimensionCount()
    Return point data dimension count

  - ### getPointIndexDimensionCount

    public int getPointIndexDimensionCount()
    Return point data dimension count

  - ### getPointNumBytes

    public int getPointNumBytes()
    Return number of bytes per dimension

  - ### getVectorDimension

    public int getVectorDimension()
    Returns the number of dimensions of the vector value

  - ### getVectorEncoding

    public VectorEncoding getVectorEncoding()
    Returns the number of dimensions of the vector value

  - ### getVectorSimilarityFunction

    public VectorSimilarityFunction getVectorSimilarityFunction()
    Returns `VectorSimilarityFunction` for the field

  - ### setDocValuesType

    public void setDocValuesType(DocValuesType type)
    Record that this field is indexed with docvalues, with the specified type

  - ### getIndexOptions

    public IndexOptions getIndexOptions()
    Returns IndexOptions for the field, or IndexOptions.NONE if the field is not indexed

  - ### getName

    public String getName()
    Returns name of this field
    Returns:
      name

  - ### getFieldNumber

    public int getFieldNumber()
    Returns the field number
    Returns:
      field number

  - ### getDocValuesType

    public DocValuesType getDocValuesType()
    Returns `DocValuesType` of the docValues; this is `DocValuesType.NONE` if the field has no docvalues.

  - ### docValuesSkipIndexType

    public DocValuesSkipIndexType docValuesSkipIndexType()
    Returns true if, and only if, this field has a skip index.

  - ### getDocValuesGen

    public long getDocValuesGen()
    Returns the docValues generation of this field, or -1 if no docValues updates exist for it.

  - ### omitsNorms

    public boolean omitsNorms()
    Returns true if norms are explicitly omitted for this field

  - ### setOmitsNorms

    public void setOmitsNorms()
    Omit norms for this field.

  - ### hasNorms

    public boolean hasNorms()
    Returns true if this field actually has any norms.

  - ### hasPayloads

    public boolean hasPayloads()
    Returns true if any payloads exist for this field.

  - ### hasTermVectors

    public boolean hasTermVectors()
    Returns true if any term vectors exist for this field.

  - ### hasVectorValues

    public boolean hasVectorValues()
    Returns whether any (numeric) vector values exist for this field

  - ### getAttribute

    public String getAttribute(String key)
    Get a codec attribute value, or null if it does not exist

  - ### putAttribute

    public String putAttribute(String key, String value)
    Puts a codec attribute value.

    This is a key-value mapping for the field that the codec can use to store additional metadata, and will be available to the codec when reading the segment via `getAttribute(String)`

    If a value already exists for the key in the field, it will be replaced with the new value. If the value of the attributes for a same field is changed between the documents, the behaviour after merge is undefined.

  - ### attributes

    public Map<String,String> attributes()
    Returns internal codec attributes map.

  - ### isSoftDeletesField

    public boolean isSoftDeletesField()
    Returns true if this field is configured and used as the soft-deletes field. See `LiveIndexWriterConfig.softDeletesField`

  - ### isParentField

    public boolean isParentField()
    Returns true if this field is configured and used as the parent document field field. See `IndexWriterConfig.setParentField(String)`

  - ### isTermDocField

    public boolean isTermDocField()
    Returns true if the field has custom term frequencies indexed that are to be treated as opaque values, while the term frequency for statistical and scoring purposes is treated as 1.