Class FieldType
- All Implemented Interfaces:
IndexableFieldType
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumData type of the numeric value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDocValuesFieldInfo.DocValuesType: if non-null then the field's value will be indexed into docValues.voidfreeze()Prevents future changes.booleanindexed()True if this field should be indexed (inverted)FieldInfo.IndexOptions, describing what should be recorded into the inverted indexintPrecision step for numeric field.NumericType: if non-null then the field's value will be indexed numerically so thatNumericRangeQuerycan be used at search time.booleanTrue if normalization values should be omitted for the field.voidSet's the field's DocValuesTypevoidsetIndexed(boolean value) Set totrueto index (invert) this field.voidSets the indexing options for the field:voidsetNumericPrecisionStep(int precisionStep) Sets the numeric precision step for the field.voidSpecifies the field's numeric type.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.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.final StringtoString()Prints a Field for human consumption.
-
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
-
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. -
indexed
public boolean indexed()True if this field should be indexed (inverted)The default is
false.- Specified by:
indexedin interfaceIndexableFieldType- See Also:
-
setIndexed
public void setIndexed(boolean value) Set totrueto index (invert) this field.- Parameters:
value- true if this field should be indexed.- Throws:
IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
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.indexed()returns false.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
IndexReader.getTermVector(int,String).This option is illegal if
IndexableFieldType.indexed()returns false.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
FieldInfo.IndexOptions, describing what should be recorded into the inverted indexThe default is
FieldInfo.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:
-
setNumericType
Specifies the field's numeric type.- Parameters:
type- numeric type, or null if the field has no numeric type.- Throws:
IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
numericType
NumericType: if non-null then the field's value will be indexed numerically so thatNumericRangeQuerycan be used at search time.The default is
null(no numeric type)- See Also:
-
setNumericPrecisionStep
public void setNumericPrecisionStep(int precisionStep) Sets the numeric precision step for the field.- Parameters:
precisionStep- numeric precision step for the field- Throws:
IllegalArgumentException- if precisionStep is less than 1.IllegalStateException- if this FieldType is frozen against future modifications.- See Also:
-
numericPrecisionStep
public int numericPrecisionStep()Precision step for numeric field.This has no effect if
numericType()returns null.The default is
NumericUtils.PRECISION_STEP_DEFAULT- See Also:
-
toString
Prints a Field for human consumption. -
docValueType
DocValuesFieldInfo.DocValuesType: if non-null then the field's value will be indexed into docValues.The default is
null(no docValues)- Specified by:
docValueTypein interfaceIndexableFieldType- See Also:
-
setDocValueType
Set's 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:
-