Class FieldType

    • Constructor Detail

      • FieldType

        public FieldType​(IndexableFieldType ref)
        Create a new mutable FieldType with all of the properties from ref
      • FieldType

        public FieldType()
        Create a new FieldType with default properties.
    • Method Detail

      • checkIfFrozen

        protected void checkIfFrozen()
        Throws an exception if this FieldType is frozen. Subclasses should call this within setters for additional state.
      • freeze

        public void freeze()
        Prevents future changes. Note, it is recommended that this is called once the FieldTypes's properties have been set, to prevent unintentional state changes.
      • setStored

        public void setStored​(boolean value)
        Set to true to store this field.
        Parameters:
        value - true if this field should be stored.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        stored()
      • setTokenized

        public void setTokenized​(boolean value)
        Set to true to tokenize this field's contents via the configured Analyzer.
        Parameters:
        value - true if this field should be tokenized.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        tokenized()
      • setStoreTermVectors

        public void setStoreTermVectors​(boolean value)
        Set to true if this field's indexed form should be also stored into term vectors.
        Parameters:
        value - true if this field should store term vectors.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        storeTermVectors()
      • setStoreTermVectorOffsets

        public void setStoreTermVectorOffsets​(boolean value)
        Set to true to also store token character offsets into the term vector for this field.
        Parameters:
        value - true if this field should store term vector offsets.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        storeTermVectorOffsets()
      • setStoreTermVectorPositions

        public void setStoreTermVectorPositions​(boolean value)
        Set to true to also store token positions into the term vector for this field.
        Parameters:
        value - true if this field should store term vector positions.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        storeTermVectorPositions()
      • setStoreTermVectorPayloads

        public void setStoreTermVectorPayloads​(boolean value)
        Set to true to also store token payloads into the term vector for this field.
        Parameters:
        value - true if this field should store term vector payloads.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        storeTermVectorPayloads()
      • omitNorms

        public boolean omitNorms()
        True if normalization values should be omitted for the field.

        This saves memory, but at the expense of scoring quality (length normalization will be disabled), and if you omit norms, you cannot use index-time boosts.

        The default is false.

        Specified by:
        omitNorms in interface IndexableFieldType
        See Also:
        setOmitNorms(boolean)
      • setOmitNorms

        public void setOmitNorms​(boolean value)
        Set to true to omit normalization values for the field.
        Parameters:
        value - true if this field should omit norms.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        omitNorms()
      • setIndexOptions

        public void setIndexOptions​(IndexOptions value)
        Sets the indexing options for the field:
        Parameters:
        value - indexing options
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        indexOptions()
      • setDimensions

        public void setDimensions​(int dimensionCount,
                                  int dimensionNumBytes)
        Enables points indexing.
      • setDimensions

        public void setDimensions​(int dimensionCount,
                                  int indexDimensionCount,
                                  int dimensionNumBytes)
        Enables points indexing with selectable dimension indexing.
      • pointDimensionCount

        public int pointDimensionCount()
        Description copied from interface: IndexableFieldType
        If this is positive (representing the number of point dimensions), the field is indexed as a point.
        Specified by:
        pointDimensionCount in interface IndexableFieldType
      • setVectorDimensionsAndSimilarityFunction

        public void setVectorDimensionsAndSimilarityFunction​(int numDimensions,
                                                             VectorSimilarityFunction distFunc)
        Enable vector indexing, with the specified number of dimensions and distance function.
      • putAttribute

        public String putAttribute​(String key,
                                   String value)
        Puts an attribute value.

        This is a key-value mapping for the field that the codec can use to store additional metadata.

        If a value already exists for the field, it will be replaced with the new value. This method is not thread-safe, user must not add attributes while other threads are indexing documents with this field type.

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

        public Map<String,​String> getAttributes()
        Description copied from interface: IndexableFieldType
        Attributes for the field type.

        Attributes are not thread-safe, user must not add attributes while other threads are indexing documents with this field type.

        Specified by:
        getAttributes in interface IndexableFieldType
        Returns:
        Map
      • toString

        public String toString()
        Prints a Field for human consumption.
        Overrides:
        toString in class Object
      • setDocValuesType

        public void setDocValuesType​(DocValuesType type)
        Sets the field's DocValuesType
        Parameters:
        type - DocValues type, or null if no DocValues should be stored.
        Throws:
        IllegalStateException - if this FieldType is frozen against future modifications.
        See Also:
        docValuesType()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object