java.lang.Object
org.apache.lucene.index.FieldInfo
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
FieldsModifier and TypeFieldDescriptionprivate DocValuesType
private long
private final IndexOptions
final String
Field's namefinal int
Internal field numberprivate boolean
private int
If both of these are positive it means this field indexed points (seePointsFormat
).private int
private int
private final boolean
private boolean
private boolean
private final int
private final VectorEncoding
private final VectorSimilarityFunction
-
Constructor Summary
ConstructorsConstructorDescriptionFieldInfo
(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, long dvGen, Map<String, String> attributes, int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, int vectorDimension, VectorEncoding vectorEncoding, VectorSimilarityFunction vectorSimilarityFunction, boolean softDeletesField) Sole constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns internal codec attributes map.void
Check correctness of the FieldInfo optionsgetAttribute
(String key) Get a codec attribute value, or null if it does not existlong
Returns the docValues generation of this field, or -1 if no docValues updates exist for it.ReturnsDocValuesType
of the docValues; this isDocValuesType.NONE
if the field has no docvalues.int
Returns the field numberReturns IndexOptions for the field, or IndexOptions.NONE if the field is not indexedgetName()
Returns name of this fieldint
Return point data dimension countint
Return point data dimension countint
Return number of bytes per dimensionint
Returns the number of dimensions of the vector valueReturns the number of dimensions of the vector valueReturnsVectorSimilarityFunction
for the fieldboolean
hasNorms()
Returns true if this field actually has any norms.boolean
Returns true if any payloads exist for this field.boolean
Returns true if any term vectors exist for this field.boolean
Returns whether any (numeric) vector values exist for this fieldboolean
Returns true if this field is configured and used as the soft-deletes field.boolean
Returns true if norms are explicitly omitted for this fieldputAttribute
(String key, String value) Puts a codec attribute value.(package private) void
setDocValuesGen
(long dvGen) Sets the docValues generation of this field.void
Record that this field is indexed with docvalues, with the specified typevoid
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.(package private) void
(package private) void
(package private) static void
verifySameDocValuesType
(String fieldName, DocValuesType docValuesType1, DocValuesType docValuesType2, boolean strictlyConsistent) Verify that the provided docValues type are the same(package private) static void
verifySameIndexOptions
(String fieldName, IndexOptions indexOptions1, IndexOptions indexOptions2, boolean strictlyConsistent) Verify that the provided index options are the same(package private) static void
verifySameOmitNorms
(String fieldName, boolean omitNorms1, boolean omitNorms2, boolean strictlyConsistent) Verify that the provided omitNorms are the same(package private) static void
verifySamePointsOptions
(String fieldName, int pointDimensionCount1, int indexDimensionCount1, int numBytes1, int pointDimensionCount2, int indexDimensionCount2, int numBytes2, boolean strictlyConsistent) Verify that the provided points indexing options are the same(package private) void
verifySameSchema
(FieldInfo o, boolean strictlyConsistent) Verify that the provided FieldInfo has the same schema as this FieldInfo(package private) static void
verifySameStoreTermVectors
(String fieldName, boolean storeTermVector1, boolean storeTermVector2, boolean strictlyConsistent) Verify that the provided store term vectors options are the same(package private) static void
verifySameVectorOptions
(String fieldName, int vd1, VectorEncoding ve1, VectorSimilarityFunction vsf1, int vd2, VectorEncoding ve2, VectorSimilarityFunction vsf2) Verify that the provided vector indexing options are the same
-
Field Details
-
name
Field's name -
number
public final int numberInternal field number -
docValuesType
-
storeTermVector
private boolean storeTermVector -
omitNorms
private boolean omitNorms -
indexOptions
-
storePayloads
private boolean storePayloads -
attributes
-
dvGen
private long dvGen -
pointDimensionCount
private int pointDimensionCountIf both of these are positive it means this field indexed points (seePointsFormat
). -
pointIndexDimensionCount
private int pointIndexDimensionCount -
pointNumBytes
private int pointNumBytes -
vectorDimension
private final int vectorDimension -
vectorEncoding
-
vectorSimilarityFunction
-
softDeletesField
private final boolean softDeletesField
-
-
Constructor Details
-
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 pointIndexDimensionCount, int pointNumBytes, int vectorDimension, VectorEncoding vectorEncoding, VectorSimilarityFunction vectorSimilarityFunction, boolean softDeletesField) Sole constructor.
-
-
Method Details
-
checkConsistency
public void checkConsistency()Check correctness of the FieldInfo options- Throws:
IllegalArgumentException
- if some options are incorrect
-
verifySameSchema
Verify that the provided FieldInfo has the same schema as this FieldInfo- Parameters:
o
- – other FieldInfo whose schema is verified against this FieldInfo's schema- Throws:
IllegalArgumentException
- if the field schemas are not the same
-
verifySameIndexOptions
static void verifySameIndexOptions(String fieldName, IndexOptions indexOptions1, IndexOptions indexOptions2, boolean strictlyConsistent) Verify that the provided index options are the same- Throws:
IllegalArgumentException
- if they are not the same
-
verifySameDocValuesType
static void verifySameDocValuesType(String fieldName, DocValuesType docValuesType1, DocValuesType docValuesType2, boolean strictlyConsistent) Verify that the provided docValues type are the same- Throws:
IllegalArgumentException
- if they are not the same
-
verifySameStoreTermVectors
static void verifySameStoreTermVectors(String fieldName, boolean storeTermVector1, boolean storeTermVector2, boolean strictlyConsistent) Verify that the provided store term vectors options are the same- Throws:
IllegalArgumentException
- if they are not the same
-
verifySameOmitNorms
static void verifySameOmitNorms(String fieldName, boolean omitNorms1, boolean omitNorms2, boolean strictlyConsistent) Verify that the provided omitNorms are the same- Throws:
IllegalArgumentException
- if they are not the same
-
verifySamePointsOptions
static void verifySamePointsOptions(String fieldName, int pointDimensionCount1, int indexDimensionCount1, int numBytes1, int pointDimensionCount2, int indexDimensionCount2, int numBytes2, boolean strictlyConsistent) Verify that the provided points indexing options are the same- Throws:
IllegalArgumentException
- if they are not the same
-
verifySameVectorOptions
static void verifySameVectorOptions(String fieldName, int vd1, VectorEncoding ve1, VectorSimilarityFunction vsf1, int vd2, VectorEncoding ve2, VectorSimilarityFunction vsf2) Verify that the provided vector indexing options are the same- Throws:
IllegalArgumentException
- if they are not the same
-
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
Returns the number of dimensions of the vector value -
getVectorSimilarityFunction
ReturnsVectorSimilarityFunction
for the field -
setDocValuesType
Record that this field is indexed with docvalues, with the specified type -
getIndexOptions
Returns IndexOptions for the field, or IndexOptions.NONE if the field is not indexed -
getName
Returns name of this field- Returns:
- name
-
getFieldNumber
public int getFieldNumber()Returns the field number- Returns:
- field number
-
getDocValuesType
ReturnsDocValuesType
of the docValues; this isDocValuesType.NONE
if the field has no docvalues. -
setDocValuesGen
void setDocValuesGen(long dvGen) Sets the docValues generation of this field. -
getDocValuesGen
public long getDocValuesGen()Returns the docValues generation of this field, or -1 if no docValues updates exist for it. -
setStoreTermVectors
void setStoreTermVectors() -
setStorePayloads
void setStorePayloads() -
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. -
hasVectorValues
public boolean hasVectorValues()Returns whether any (numeric) vector values exist for this field -
getAttribute
Get a codec attribute value, or null if it does not exist -
putAttribute
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
Returns internal codec attributes map. -
isSoftDeletesField
public boolean isSoftDeletesField()Returns true if this field is configured and used as the soft-deletes field. SeeLiveIndexWriterConfig.softDeletesField
-