Class FieldType
- All Implemented Interfaces:
IndexableFieldType
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new FieldType with default properties.Create a new mutable FieldType with all of the properties fromref -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThrows an exception if this FieldType is frozen.Whether a skip index for doc values should be created on this field.DocValuesDocValuesType: how the field's value will be indexed into docValues.booleanvoidfreeze()Prevents future changes.Attributes for the field type.inthashCode()IndexOptions, describing what should be recorded into the inverted indexbooleanTrue if normalization values should be omitted for the field.intIf this is positive (representing the number of point dimensions), the field is indexed as a point.intThe number of dimensions used for the index keyintThe number of bytes in each dimension's values.putAttribute(String key, String value) Puts an attribute value.voidsetDimensions(int dimensionCount, int dimensionNumBytes) Enables points indexing.voidsetDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) Enables points indexing with selectable dimension indexing.voidsetDocValuesSkipIndexType(DocValuesSkipIndexType docValuesSkipIndex) Set whether to enable a skip index for doc values on this field.voidSets the field's DocValuesTypevoidsetIndexOptions(IndexOptions value) Sets the indexing options for the field:voidsetOmitNorms(boolean value) Set totrueto omit normalization values for the field.voidsetStored(boolean value) Set totrueto store this field.voidsetStoreTermVectorOffsets(boolean value) Set totrueto also store token character offsets into the term vector for this field.voidsetStoreTermVectorPayloads(boolean value) Set totrueto also store token payloads into the term vector for this field.voidsetStoreTermVectorPositions(boolean value) Set totrueto also store token positions into the term vector for this field.voidsetStoreTermVectors(boolean value) Set totrueif this field's indexed form should be also stored into term vectors.voidsetTokenized(boolean value) Set totrueto tokenize this field's contents via the configuredAnalyzer.voidsetVectorAttributes(int numDimensions, VectorEncoding encoding, VectorSimilarityFunction similarity) Enable vector indexing, with the specified number of dimensions and distance function.booleanstored()True if the field's value should be storedbooleanTrue if this field's token character offsets should also be stored into term vectors.booleanTrue if this field's token payloads should also be stored into the term vectors.booleanTrue if this field's token positions should also be stored into the term vectors.booleanTrue if this field's indexed form should be also stored into term vectors.booleanTrue if this field's value should be analyzed by theAnalyzer.toString()Prints a Field for human consumption.intThe number of dimensions of the field's vector valueTheVectorEncodingof the field's vector valueTheVectorSimilarityFunctionof the field's vector value
-
Constructor Details
-
FieldType
Create a new mutable FieldType with all of the properties fromref -
FieldType
public FieldType()Create a new FieldType with default properties.
-
-
Method Details
-
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. -
stored
public boolean stored()True if the field's value should be storedThe default is
false.- Specified by:
storedin interfaceIndexableFieldType- See Also:
-
setStored
public void setStored(boolean value) Set totrueto store this field.- Parameters:
value- true if this field should be stored.- Throws:
IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
tokenized
public boolean tokenized()True if this field's value should be analyzed by theAnalyzer.This has no effect if
IndexableFieldType.indexOptions()returns IndexOptions.NONE.The default is
true.- Specified by:
tokenizedin interfaceIndexableFieldType- See Also:
-
setTokenized
public void setTokenized(boolean value) Set totrueto tokenize this field's contents via the configuredAnalyzer.- Parameters:
value- true if this field should be tokenized.- Throws:
IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
storeTermVectors
public boolean storeTermVectors()True if this field's indexed form should be also stored into term vectors.This builds a miniature inverted-index for this field which can be accessed in a document-oriented way from
TermVectors.get(int,String).This option is illegal if
IndexableFieldType.indexOptions()returns IndexOptions.NONE.The default is
false.- Specified by:
storeTermVectorsin interfaceIndexableFieldType- See Also:
-
setStoreTermVectors
public void setStoreTermVectors(boolean value) Set totrueif 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:
-
storeTermVectorOffsets
public boolean storeTermVectorOffsets()True if this field's token character offsets should also be stored into term vectors.This option is illegal if term vectors are not enabled for the field (
IndexableFieldType.storeTermVectors()is false)The default is
false.- Specified by:
storeTermVectorOffsetsin interfaceIndexableFieldType- See Also:
-
setStoreTermVectorOffsets
public void setStoreTermVectorOffsets(boolean value) Set totrueto 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:
-
storeTermVectorPositions
public boolean storeTermVectorPositions()True if this field's token positions should also be stored into the term vectors.This option is illegal if term vectors are not enabled for the field (
IndexableFieldType.storeTermVectors()is false).The default is
false.- Specified by:
storeTermVectorPositionsin interfaceIndexableFieldType- See Also:
-
setStoreTermVectorPositions
public void setStoreTermVectorPositions(boolean value) Set totrueto 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:
-
storeTermVectorPayloads
public boolean storeTermVectorPayloads()True if this field's token payloads should also be stored into the term vectors.This option is illegal if term vector positions are not enabled for the field (
IndexableFieldType.storeTermVectors()is false).The default is
false.- Specified by:
storeTermVectorPayloadsin interfaceIndexableFieldType- See Also:
-
setStoreTermVectorPayloads
public void setStoreTermVectorPayloads(boolean value) Set totrueto 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:
-
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:
omitNormsin interfaceIndexableFieldType- See Also:
-
setOmitNorms
public void setOmitNorms(boolean value) Set totrueto 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:
-
indexOptions
IndexOptions, describing what should be recorded into the inverted indexThe default is
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS.- Specified by:
indexOptionsin interfaceIndexableFieldType- See Also:
-
setIndexOptions
Sets the indexing options for the field:- Parameters:
value- indexing options- Throws:
IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
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:IndexableFieldTypeIf this is positive (representing the number of point dimensions), the field is indexed as a point.- Specified by:
pointDimensionCountin interfaceIndexableFieldType
-
pointIndexDimensionCount
public int pointIndexDimensionCount()Description copied from interface:IndexableFieldTypeThe number of dimensions used for the index key- Specified by:
pointIndexDimensionCountin interfaceIndexableFieldType
-
pointNumBytes
public int pointNumBytes()Description copied from interface:IndexableFieldTypeThe number of bytes in each dimension's values.- Specified by:
pointNumBytesin interfaceIndexableFieldType
-
setVectorAttributes
public void setVectorAttributes(int numDimensions, VectorEncoding encoding, VectorSimilarityFunction similarity) Enable vector indexing, with the specified number of dimensions and distance function. -
vectorDimension
public int vectorDimension()Description copied from interface:IndexableFieldTypeThe number of dimensions of the field's vector value- Specified by:
vectorDimensionin interfaceIndexableFieldType
-
vectorEncoding
Description copied from interface:IndexableFieldTypeTheVectorEncodingof the field's vector value- Specified by:
vectorEncodingin interfaceIndexableFieldType
-
vectorSimilarityFunction
Description copied from interface:IndexableFieldTypeTheVectorSimilarityFunctionof the field's vector value- Specified by:
vectorSimilarityFunctionin interfaceIndexableFieldType
-
putAttribute
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
Description copied from interface:IndexableFieldTypeAttributes 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:
getAttributesin interfaceIndexableFieldType- Returns:
- Map
-
toString
Prints a Field for human consumption. -
docValuesType
DocValuesDocValuesType: how the field's value will be indexed into docValues.The default is
null(no docValues)- Specified by:
docValuesTypein interfaceIndexableFieldType- See Also:
-
setDocValuesType
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:
-
docValuesSkipIndexType
Description copied from interface:IndexableFieldTypeWhether a skip index for doc values should be created on this field.- Specified by:
docValuesSkipIndexTypein interfaceIndexableFieldType
-
setDocValuesSkipIndexType
Set whether to enable a skip index for doc values on this field. This is typically useful on fields that are part of theindex sort, or that correlate with fields that are part of the index sort, so that values can be expected to be clustered in the doc ID space. -
hashCode
public int hashCode() -
equals
-