Class FieldInfos.Builder

  • Enclosing class:
    FieldInfos

    static final class FieldInfos.Builder
    extends java.lang.Object
    • Field Detail

      • byName

        private final java.util.HashMap<java.lang.String,​FieldInfo> byName
      • finished

        private boolean finished
    • 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 schema
        java.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 add
        dvGen - – 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 schema
        java.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