add

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.

Return

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.

Parameters

fi

– FieldInfo to add

Throws

if there already exists field with this name globally but with a different schema.

if the Builder is already finished building and doesn't accept new fields.


fun add(fi: FieldInfo, dvGen: Long): FieldInfo

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.

Return

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.

Parameters

fi

– FieldInfo to add

dvGen

– doc values generation of the FieldInfo to add

Throws

if there already exists field with this name globally but with a different schema.

if the Builder is already finished building and doesn't accept new fields.