Package org.apache.lucene.index
Class FieldInfos.Builder
- java.lang.Object
-
- org.apache.lucene.index.FieldInfos.Builder
-
- Enclosing class:
- FieldInfos
static final class FieldInfos.Builder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,FieldInfo>
byName
private boolean
finished
(package private) FieldInfos.FieldNumbers
globalFieldNumbers
-
Constructor Summary
Constructors Constructor Description Builder(FieldInfos.FieldNumbers globalFieldNumbers)
Creates a new instance with the givenFieldInfos.FieldNumbers
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldInfo
add(FieldInfo fi)
Adds the provided FieldInfo to this Builder if this field doesn't exist in this Builder.(package private) FieldInfo
add(FieldInfo fi, long dvGen)
Adds the provided FieldInfo with the provided dvGen to this Builder if this field doesn't exist in this Builder.private boolean
assertNotFinished()
Called only from assertFieldInfo
fieldInfo(java.lang.String fieldName)
(package private) FieldInfos
finish()
java.lang.String
getSoftDeletesFieldName()
-
-
-
Field Detail
-
byName
private final java.util.HashMap<java.lang.String,FieldInfo> byName
-
globalFieldNumbers
final FieldInfos.FieldNumbers globalFieldNumbers
-
finished
private boolean finished
-
-
Constructor Detail
-
Builder
Builder(FieldInfos.FieldNumbers globalFieldNumbers)
Creates a new instance with the givenFieldInfos.FieldNumbers
.
-
-
Method Detail
-
getSoftDeletesFieldName
public java.lang.String getSoftDeletesFieldName()
-
add
public FieldInfo add(FieldInfo fi)
Adds the provided FieldInfo to this Builder if this field doesn't exist in this Builder. Also adds a new field with its schema options to the global FieldNumbers if the field doesn't exist globally in the index. The field number is reused if possible for consistent field numbers across segments.If the field already exists: 1) the provided FieldInfo's schema is checked against the existing field and 2) the provided FieldInfo's attributes are added to the existing FieldInfo's attributes.
- Parameters:
fi
- – FieldInfo to add- Returns:
- The existing FieldInfo if the field with this name already exists in the builder, or a new constructed FieldInfo with the same schema as provided and a consistent global field number.
- Throws:
java.lang.IllegalArgumentException
- if there already exists field with this name in Builder but with a different schemajava.lang.IllegalArgumentException
- if there already exists field with this name globally but with a different schema.java.lang.IllegalStateException
- if the Builder is already finished building and doesn't accept new fields.
-
add
FieldInfo add(FieldInfo fi, long dvGen)
Adds the provided FieldInfo with the provided dvGen to this Builder if this field doesn't exist in this Builder. Also adds a new field with its schema options to the global FieldNumbers if the field doesn't exist globally in the index. The field number is reused if possible for consistent field numbers across segments.If the field already exists: 1) the provided FieldInfo's schema is checked against the existing field and 2) the provided FieldInfo's attributes are added to the existing FieldInfo's attributes.
- Parameters:
fi
- – FieldInfo to adddvGen
- – doc values generation of the FieldInfo to add- Returns:
- The existing FieldInfo if the field with this name already exists in the builder, or a new constructed FieldInfo with the same schema as provided and a consistent global field number.
- Throws:
java.lang.IllegalArgumentException
- if there already exists field with this name in Builder but with a different schemajava.lang.IllegalArgumentException
- if there already exists field with this name globally but with a different schema.java.lang.IllegalStateException
- if the Builder is already finished building and doesn't accept new fields.
-
fieldInfo
public FieldInfo fieldInfo(java.lang.String fieldName)
-
assertNotFinished
private boolean assertNotFinished()
Called only from assert
-
finish
FieldInfos finish()
-
-