org.apache.solr.schema

## Class ManagedIndexSchema

- java.lang.Object
- - org.apache.solr.schema.IndexSchema
  - - org.apache.solr.schema.ManagedIndexSchema

-     public final class ManagedIndexSchema
      extends IndexSchema

  Solr-managed schema - non-user-editable, but can be mutable via internal and external REST API requests.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ManagedIndexSchema.FieldExistsException`
    `class` | `ManagedIndexSchema.SchemaChangedInZkException`

    - ### Nested classes/interfaces inherited from class org.apache.solr.schema.IndexSchema

      `IndexSchema.DynamicCopy, IndexSchema.DynamicField, IndexSchema.DynamicReplacement, IndexSchema.SchemaProps`

  - ### Field Summary

    - ### Fields inherited from class org.apache.solr.schema.IndexSchema

      `COPY_FIELD, COPY_FIELDS, copyFieldsMap, copyFieldTargetCounts, DEFAULT_OPERATOR, DEFAULT_SCHEMA_FILE, DEFAULT_SEARCH_FIELD, defaultSearchFieldName, DESTINATION, DYNAMIC_FIELD, DYNAMIC_FIELDS, dynamicCopyFields, dynamicFields, FIELD, FIELD_TYPE, FIELD_TYPES, fields, FIELDS, fieldsWithDefaultValue, fieldTypes, INTERNAL_POLY_FIELD_PREFIX, isExplicitQueryParserDefaultOperator, isExplicitSimilarity, loader, LUCENE_MATCH_VERSION_PARAM, MAX_CHARS, name, NAME, nameMapping, queryParserDefaultOperator, REQUIRED, requiredFields, resourceName, SCHEMA, schemaAware, similarity, SIMILARITY, similarityFactory, SLASH, SOLR_QUERY_PARSER, solrConfig, SOURCE, TYPE, TYPES, UNIQUE_KEY, uniqueKeyField, uniqueKeyFieldName, uniqueKeyFieldType, version, VERSION`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ManagedIndexSchema` | `addCopyFields(Map<String,Collection<String>> copyFields, boolean persist)` Copies this schema and adds the new copy fields to the copy Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
    `ManagedIndexSchema` | `addCopyFields(String source, Collection<String> destinations, int maxChars)` Copies this schema and adds the new copy fields to the copy.
    `ManagedIndexSchema` | `addDynamicFields(Collection<SchemaField> newDynamicFields, Map<String,Collection<String>> copyFieldNames, boolean persist)` Copies this schema, adds the given dynamic fields to the copy, Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
    `ManagedIndexSchema` | `addFields(Collection<SchemaField> newFields, Map<String,Collection<String>> copyFieldNames, boolean persist)` Copies this schema, adds the given fields to the copy Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
    `ManagedIndexSchema` | `addFieldTypes(List<FieldType> fieldTypeList, boolean persist)` Copies this schema, adds the given field type to the copy, Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
    `ManagedIndexSchema` | `deleteCopyFields(Map<String,Collection<String>> copyFields)` Copies this schema and deletes the given copy fields from the copy.
    `ManagedIndexSchema` | `deleteDynamicFields(Collection<String> fieldNamePatterns)` Copies this schema, deletes the named dynamic fields from the copy.
    `ManagedIndexSchema` | `deleteFields(Collection<String> names)` Copies this schema, deletes the named fields from the copy.
    `ManagedIndexSchema` | `deleteFieldTypes(Collection<String> names)` Copies this schema, deletes the named field types from the copy.
    `protected static List<String>` | `getActiveReplicaCoreUrls(ZkController zkController, String collection, String localCoreNodeName)`
    `Object` | `getSchemaUpdateLock()` Returns the schema update lock that should be synchronized on to update the schema.
    `int` | `getSchemaZkVersion()`
    `protected void` | `informResourceLoaderAwareObjectsForFieldType(FieldType fieldType)` Informs analyzers used by a fieldType.
    `protected void` | `informResourceLoaderAwareObjectsInChain(TokenizerChain chain)` After creating a new FieldType, it may contain components that implement the ResourceLoaderAware interface, which need to be informed after they are loaded (as they depend on this callback to complete initialization work)
    `boolean` | `isMutable()`
    `SchemaField` | `newDynamicField(String fieldNamePattern, String fieldType, Map<String,?> options)` Returns a SchemaField if the given dynamic field glob does not already exist in this schema, and does not match any dynamic fields in this schema.
    `SchemaField` | `newField(String fieldName, String fieldType, Map<String,?> options)` Returns a SchemaField if the given fieldName does not already exist in this schema, and does not match any dynamic fields in this schema.
    `FieldType` | `newFieldType(String typeName, String className, Map<String,?> options)` Returns a FieldType if the given typeName does not already exist in this schema.
    `protected void` | `postReadInform()`
    `ManagedIndexSchema` | `replaceDynamicField(String fieldNamePattern, FieldType replacementFieldType, Map<String,?> replacementArgs)` Copies this schema, deletes the named dynamic field from the copy, creates a new dynamic field with the same field name pattern using the given args, then rebinds any referring dynamic copy fields to the replacement dynamic field.
    `ManagedIndexSchema` | `replaceField(String fieldName, FieldType replacementFieldType, Map<String,?> replacementArgs)` Copies this schema, deletes the named field from the copy, creates a new field with the same name using the given args, then rebinds any referring copy fields to the replacement field.
    `ManagedIndexSchema` | `replaceFieldType(String typeName, String replacementClassName, Map<String,Object> replacementArgs)` Copies this schema, deletes the named field type from the copy, creates a new field type with the same name using the given args, rebuilds fields and dynamic fields of the given type, then rebinds any referring copy fields to the rebuilt fields.
    `static void` | `waitForSchemaZkVersionAgreement(String collection, String localCoreNodeName, int schemaZkVersion, ZkController zkController, int maxWaitSecs)` Block up to a specified maximum time until we see agreement on the schema version in ZooKeeper across all replicas for a collection.

    - ### Methods inherited from class org.apache.solr.schema.IndexSchema

      `addField, addField, addField, addFields, dynamicFieldListToSortedArray, getCopyFieldProperties, getCopyFieldsList, getCopyFieldsMap, getCopySources, getDefaultLuceneMatchVersion, getDefaultSearchFieldName, getDynamicCopyFields, getDynamicFieldPrototypes, getDynamicFields, getDynamicFieldType, getDynamicPattern, getField, getFieldOrNull, getFields, getFieldsWithDefaultValue, getFieldType, getFieldTypeByName, getFieldTypeNoEx, getFieldTypes, getFieldTypeXPathExpressions, getIndexAnalyzer, getNamedPropertyValues, getNamedPropertyValues, getQueryAnalyzer, getQueryParserDefaultOperator, getRequiredFields, getResourceLoader, getResourceName, getSchemaName, getSimilarity, getSimilarityFactory, getUninversionMap, getUniqueKeyField, getUniqueKeyField, getVersion, hasExplicitField, isCopyFieldTarget, isDuplicateDynField, isDynamicField, isValidDynamicField, isValidFieldGlob, loadCopyFields, loadFields, printableUniqueKey, readSchema, refreshAnalyzers, registerCopyField, registerCopyField, registerDynamicFields, registerExplicitSrcAndDestFields, setResourceName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isMutable

          public boolean isMutable()

      Overrides:
        `isMutable` in class `IndexSchema`

    - #### waitForSchemaZkVersionAgreement

          public static void waitForSchemaZkVersionAgreement(String collection,
                                                             String localCoreNodeName,
                                                             int schemaZkVersion,
                                                             ZkController zkController,
                                                             int maxWaitSecs)

      Block up to a specified maximum time until we see agreement on the schema version in ZooKeeper across all replicas for a collection.

    - #### getActiveReplicaCoreUrls

          protected static List<String> getActiveReplicaCoreUrls(ZkController zkController,
                                                                 String collection,
                                                                 String localCoreNodeName)

    - #### addFields

          public ManagedIndexSchema addFields(Collection<SchemaField> newFields,
                                              Map<String,Collection<String>> copyFieldNames,
                                              boolean persist)

      Description copied from class: `IndexSchema`
      Copies this schema, adds the given fields to the copy Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
      Overrides:
        `addFields` in class `IndexSchema`
      Parameters:
        `newFields` - the SchemaFields to add
        `copyFieldNames` - 0 or more names of targets to copy this field to. The target fields must already exist.
        `persist` - Persist the schema or not
      Returns:
        a new IndexSchema based on this schema with newFields added
      See Also:
        `IndexSchema.newField(String, String, Map)`

    - #### deleteFields

          public ManagedIndexSchema deleteFields(Collection<String> names)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named fields from the copy.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `deleteFields` in class `IndexSchema`
      Parameters:
        `names` - the names of the fields to delete
      Returns:
        a new IndexSchema based on this schema with the named fields deleted

    - #### replaceField

          public ManagedIndexSchema replaceField(String fieldName,
                                                 FieldType replacementFieldType,
                                                 Map<String,?> replacementArgs)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named field from the copy, creates a new field with the same name using the given args, then rebinds any referring copy fields to the replacement field.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `replaceField` in class `IndexSchema`
      Parameters:
        `fieldName` - The name of the field to be replaced
        `replacementFieldType` - The field type of the replacement field
        `replacementArgs` - Initialization params for the replacement field
      Returns:
        a new IndexSchema based on this schema with the named field replaced

    - #### addDynamicFields

          public ManagedIndexSchema addDynamicFields(Collection<SchemaField> newDynamicFields,
                                                     Map<String,Collection<String>> copyFieldNames,
                                                     boolean persist)

      Description copied from class: `IndexSchema`
      Copies this schema, adds the given dynamic fields to the copy, Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
      Overrides:
        `addDynamicFields` in class `IndexSchema`
      Parameters:
        `newDynamicFields` - the SchemaFields to add
        `copyFieldNames` - 0 or more names of targets to copy this field to. The target fields must already exist.
        `persist` - to persist the schema or not
      Returns:
        a new IndexSchema based on this schema with newDynamicFields added
      See Also:
        `IndexSchema.newDynamicField(String, String, Map)`

    - #### deleteDynamicFields

          public ManagedIndexSchema deleteDynamicFields(Collection<String> fieldNamePatterns)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named dynamic fields from the copy.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `deleteDynamicFields` in class `IndexSchema`
      Parameters:
        `fieldNamePatterns` - the names of the dynamic fields to delete
      Returns:
        a new IndexSchema based on this schema with the named dynamic fields deleted

    - #### replaceDynamicField

          public ManagedIndexSchema replaceDynamicField(String fieldNamePattern,
                                                        FieldType replacementFieldType,
                                                        Map<String,?> replacementArgs)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named dynamic field from the copy, creates a new dynamic field with the same field name pattern using the given args, then rebinds any referring dynamic copy fields to the replacement dynamic field.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `replaceDynamicField` in class `IndexSchema`
      Parameters:
        `fieldNamePattern` - The glob for the dynamic field to be replaced
        `replacementFieldType` - The field type of the replacement dynamic field
        `replacementArgs` - Initialization params for the replacement dynamic field
      Returns:
        a new IndexSchema based on this schema with the named dynamic field replaced

    - #### addCopyFields

          public ManagedIndexSchema addCopyFields(Map<String,Collection<String>> copyFields,
                                                  boolean persist)

      Description copied from class: `IndexSchema`
      Copies this schema and adds the new copy fields to the copy Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
      Overrides:
        `addCopyFields` in class `IndexSchema`
      Parameters:
        `copyFields` - Key is the name of the source field name, value is a collection of target field names. Fields must exist.
        `persist` - to persist the schema or not
      Returns:
        The new Schema with the copy fields added
      See Also:
        `to limit the number of copied characters.`

    - #### addCopyFields

          public ManagedIndexSchema addCopyFields(String source,
                                                  Collection<String> destinations,
                                                  int maxChars)

      Description copied from class: `IndexSchema`
      Copies this schema and adds the new copy fields to the copy. Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`
      Overrides:
        `addCopyFields` in class `IndexSchema`
      Parameters:
        `source` - source field name
        `destinations` - collection of target field names
        `maxChars` - max number of characters to copy from the source to each of the destinations. Use `CopyField.UNLIMITED` if you don't want to limit the number of copied chars.
      Returns:
        The new Schema with the copy fields added

    - #### deleteCopyFields

          public ManagedIndexSchema deleteCopyFields(Map<String,Collection<String>> copyFields)

      Description copied from class: `IndexSchema`
      Copies this schema and deletes the given copy fields from the copy.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `deleteCopyFields` in class `IndexSchema`
      Parameters:
        `copyFields` - Key is the name of the source field name, value is a collection of target field names. Each corresponding copy field directives must exist.
      Returns:
        The new Schema with the copy fields deleted

    - #### addFieldTypes

          public ManagedIndexSchema addFieldTypes(List<FieldType> fieldTypeList,
                                                  boolean persist)

      Description copied from class: `IndexSchema`
      Copies this schema, adds the given field type to the copy, Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.
      Overrides:
        `addFieldTypes` in class `IndexSchema`
      Parameters:
        `fieldTypeList` - a list of FieldTypes to add
        `persist` - to persist the schema or not
      Returns:
        a new IndexSchema based on this schema with the new types added
      See Also:
        `IndexSchema.newFieldType(String, String, Map)`

    - #### deleteFieldTypes

          public ManagedIndexSchema deleteFieldTypes(Collection<String> names)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named field types from the copy.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `deleteFieldTypes` in class `IndexSchema`
      Parameters:
        `names` - the names of the field types to delete
      Returns:
        a new IndexSchema based on this schema with the named field types deleted

    - #### replaceFieldType

          public ManagedIndexSchema replaceFieldType(String typeName,
                                                     String replacementClassName,
                                                     Map<String,Object> replacementArgs)

      Description copied from class: `IndexSchema`
      Copies this schema, deletes the named field type from the copy, creates a new field type with the same name using the given args, rebuilds fields and dynamic fields of the given type, then rebinds any referring copy fields to the rebuilt fields.

      The schema will not be persisted.

      Requires synchronizing on the object returned by `IndexSchema.getSchemaUpdateLock()`.

      Overrides:
        `replaceFieldType` in class `IndexSchema`
      Parameters:
        `typeName` - The name of the field type to be replaced
        `replacementClassName` - The class name of the replacement field type
        `replacementArgs` - Initialization params for the replacement field type
      Returns:
        a new IndexSchema based on this schema with the named field type replaced

    - #### postReadInform

          protected void postReadInform()

      Overrides:
        `postReadInform` in class `IndexSchema`

    - #### informResourceLoaderAwareObjectsForFieldType

          protected void informResourceLoaderAwareObjectsForFieldType(FieldType fieldType)

      Informs analyzers used by a fieldType.

    - #### newField

          public SchemaField newField(String fieldName,
                                      String fieldType,
                                      Map<String,?> options)

      Description copied from class: `IndexSchema`
      Returns a SchemaField if the given fieldName does not already exist in this schema, and does not match any dynamic fields in this schema. The resulting SchemaField can be used in a call to `IndexSchema.addField(SchemaField)`.
      Overrides:
        `newField` in class `IndexSchema`
      Parameters:
        `fieldName` - the name of the field to add
        `fieldType` - the field type for the new field
        `options` - the options to use when creating the SchemaField
      Returns:
        The created SchemaField
      See Also:
        `IndexSchema.addField(SchemaField)`

    - #### getSchemaZkVersion

          public int getSchemaZkVersion()

    - #### newDynamicField

          public SchemaField newDynamicField(String fieldNamePattern,
                                             String fieldType,
                                             Map<String,?> options)

      Description copied from class: `IndexSchema`
      Returns a SchemaField if the given dynamic field glob does not already exist in this schema, and does not match any dynamic fields in this schema. The resulting SchemaField can be used in a call to `IndexSchema.addField(SchemaField)`.
      Overrides:
        `newDynamicField` in class `IndexSchema`
      Parameters:
        `fieldNamePattern` - the pattern for the dynamic field to add
        `fieldType` - the field type for the new field
        `options` - the options to use when creating the SchemaField
      Returns:
        The created SchemaField
      See Also:
        `IndexSchema.addField(SchemaField)`

    - #### newFieldType

          public FieldType newFieldType(String typeName,
                                        String className,
                                        Map<String,?> options)

      Description copied from class: `IndexSchema`
      Returns a FieldType if the given typeName does not already exist in this schema. The resulting FieldType can be used in a call to `IndexSchema.addFieldTypes(java.util.List, boolean)`.
      Overrides:
        `newFieldType` in class `IndexSchema`
      Parameters:
        `typeName` - the name of the type to add
        `className` - the name of the FieldType class
        `options` - the options to use when creating the FieldType
      Returns:
        The created FieldType
      See Also:
        `IndexSchema.addFieldTypes(java.util.List, boolean)`

    - #### informResourceLoaderAwareObjectsInChain

          protected void informResourceLoaderAwareObjectsInChain(TokenizerChain chain)

      After creating a new FieldType, it may contain components that implement the ResourceLoaderAware interface, which need to be informed after they are loaded (as they depend on this callback to complete initialization work)

    - #### getSchemaUpdateLock

          public Object getSchemaUpdateLock()

      Description copied from class: `IndexSchema`
      Returns the schema update lock that should be synchronized on to update the schema. Only applicable to mutable schemas.
      Overrides:
        `getSchemaUpdateLock` in class `IndexSchema`
      Returns:
        the schema update lock object to synchronize on

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.