org.apache.lucene.index

Class 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 Detail

      • number

        public final int number
        Internal field number
    • Constructor Detail

      • FieldInfo

        public FieldInfo(String name,
                         int number,
                         boolean storeTermVector,
                         boolean omitNorms,
                         boolean storePayloads,
                         IndexOptions indexOptions,
                         DocValuesType docValues,
                         long dvGen,
                         Map<String,String> attributes,
                         int pointDimensionCount,
                         int pointNumBytes)
        Sole constructor.
    • Method Detail

      • checkConsistency

        public boolean checkConsistency()
        Performs internal consistency checks. Always returns true (or throws IllegalStateException)
      • setPointDimensions

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

        public int getPointNumBytes()
        Return number of bytes per dimension
      • getIndexOptions

        public IndexOptions getIndexOptions()
        Returns IndexOptions for the field, or IndexOptions.NONE if the field is not indexed
      • 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.
      • hasVectors

        public boolean hasVectors()
        Returns true if any term vectors exist for this field.
      • 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 field, it will be replaced with the new value.