- java.lang.Object
-
- org.apache.lucene.index.FieldInfos
-
- All Implemented Interfaces:
java.lang.Iterable<FieldInfo>
- Direct Known Subclasses:
PerFieldMergeState.FilterFieldInfos
public class FieldInfos extends java.lang.Object implements java.lang.Iterable<FieldInfo>
Collection ofFieldInfo
s (accessible by number or by name).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
FieldInfos.Builder
(package private) static class
FieldInfos.FieldDimensions
(package private) static class
FieldInfos.FieldNumbers
(package private) static class
FieldInfos.FieldVectorProperties
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,FieldInfo>
byName
private FieldInfo[]
byNumber
static FieldInfos
EMPTY
An instance without any fields.private boolean
hasDocValues
private boolean
hasFreq
private boolean
hasNorms
private boolean
hasOffsets
private boolean
hasPayloads
private boolean
hasPointValues
private boolean
hasPostings
private boolean
hasProx
private boolean
hasVectors
private boolean
hasVectorValues
private java.lang.String
parentField
private java.lang.String
softDeletesField
private java.util.Collection<FieldInfo>
values
Iterator in ascending order of field number.
-
Constructor Summary
Constructors Constructor Description FieldInfos(FieldInfo[] infos)
Constructs a new FieldInfos from an array of FieldInfo objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldInfo
fieldInfo(int fieldNumber)
Return the fieldinfo object referenced by the fieldNumber.FieldInfo
fieldInfo(java.lang.String fieldName)
Return the fieldinfo object referenced by the field nameprivate static java.lang.String
getAndValidateParentField(java.util.List<LeafReaderContext> leaves)
static java.util.Collection<java.lang.String>
getIndexedFields(IndexReader reader)
Returns a set of names of fields that have a terms index.static FieldInfos
getMergedFieldInfos(IndexReader reader)
Call this to get the (merged) FieldInfos for a composite reader.java.lang.String
getParentField()
Returns the parent document field name if exists; otherwise returns nulljava.lang.String
getSoftDeletesField()
Returns the soft-deletes field name if exists; otherwise returns nullboolean
hasDocValues()
Returns true if any fields have DocValuesboolean
hasFreq()
Returns true if any fields have freqsboolean
hasNorms()
Returns true if any fields have normsboolean
hasOffsets()
Returns true if any fields have offsetsboolean
hasPayloads()
Returns true if any fields have payloadsboolean
hasPointValues()
Returns true if any fields have PointValuesboolean
hasPostings()
Returns true if any fields have postingsboolean
hasProx()
Returns true if any fields have positionsboolean
hasVectors()
Returns true if any fields have vectorsboolean
hasVectorValues()
Returns true if any fields have vector valuesjava.util.Iterator<FieldInfo>
iterator()
Returns an iterator over all the fieldinfo objects present, ordered by ascending field numberint
size()
Returns the number of fields
-
-
-
Field Detail
-
EMPTY
public static final FieldInfos EMPTY
An instance without any fields.
-
hasFreq
private final boolean hasFreq
-
hasPostings
private final boolean hasPostings
-
hasProx
private final boolean hasProx
-
hasPayloads
private final boolean hasPayloads
-
hasOffsets
private final boolean hasOffsets
-
hasVectors
private final boolean hasVectors
-
hasNorms
private final boolean hasNorms
-
hasDocValues
private final boolean hasDocValues
-
hasPointValues
private final boolean hasPointValues
-
hasVectorValues
private final boolean hasVectorValues
-
softDeletesField
private final java.lang.String softDeletesField
-
parentField
private final java.lang.String parentField
-
byNumber
private final FieldInfo[] byNumber
-
byName
private final java.util.HashMap<java.lang.String,FieldInfo> byName
-
values
private final java.util.Collection<FieldInfo> values
Iterator in ascending order of field number.
-
-
Constructor Detail
-
FieldInfos
public FieldInfos(FieldInfo[] infos)
Constructs a new FieldInfos from an array of FieldInfo objects. The array can be used directly as the backing structure.
-
-
Method Detail
-
getMergedFieldInfos
public static FieldInfos getMergedFieldInfos(IndexReader reader)
Call this to get the (merged) FieldInfos for a composite reader.NOTE: the returned field numbers will likely not correspond to the actual field numbers in the underlying readers, and codec metadata (
FieldInfo.getAttribute(String)
will be unavailable.
-
getAndValidateParentField
private static java.lang.String getAndValidateParentField(java.util.List<LeafReaderContext> leaves)
-
getIndexedFields
public static java.util.Collection<java.lang.String> getIndexedFields(IndexReader reader)
Returns a set of names of fields that have a terms index. The order is undefined.
-
hasFreq
public boolean hasFreq()
Returns true if any fields have freqs
-
hasPostings
public boolean hasPostings()
Returns true if any fields have postings
-
hasProx
public boolean hasProx()
Returns true if any fields have positions
-
hasPayloads
public boolean hasPayloads()
Returns true if any fields have payloads
-
hasOffsets
public boolean hasOffsets()
Returns true if any fields have offsets
-
hasVectors
public boolean hasVectors()
Returns true if any fields have vectors
-
hasNorms
public boolean hasNorms()
Returns true if any fields have norms
-
hasDocValues
public boolean hasDocValues()
Returns true if any fields have DocValues
-
hasPointValues
public boolean hasPointValues()
Returns true if any fields have PointValues
-
hasVectorValues
public boolean hasVectorValues()
Returns true if any fields have vector values
-
getSoftDeletesField
public java.lang.String getSoftDeletesField()
Returns the soft-deletes field name if exists; otherwise returns null
-
getParentField
public java.lang.String getParentField()
Returns the parent document field name if exists; otherwise returns null
-
size
public int size()
Returns the number of fields
-
iterator
public java.util.Iterator<FieldInfo> iterator()
Returns an iterator over all the fieldinfo objects present, ordered by ascending field number- Specified by:
iterator
in interfacejava.lang.Iterable<FieldInfo>
-
fieldInfo
public FieldInfo fieldInfo(java.lang.String fieldName)
Return the fieldinfo object referenced by the field name- Returns:
- the FieldInfo object or null when the given fieldName doesn't exist.
-
fieldInfo
public FieldInfo fieldInfo(int fieldNumber)
Return the fieldinfo object referenced by the fieldNumber.- Parameters:
fieldNumber
- field's number.- Returns:
- the FieldInfo object or null when the given fieldNumber doesn't exist.
- Throws:
java.lang.IllegalArgumentException
- if fieldNumber is negative
-
-