public final class ManagedIndexSchema extends IndexSchema
Modifier and Type | Class and Description |
---|---|
static class |
ManagedIndexSchema.FieldExistsException |
static class |
ManagedIndexSchema.SchemaChangedInZkException |
IndexSchema.DynamicCopy, IndexSchema.DynamicField, IndexSchema.DynamicReplacement, IndexSchema.SchemaProps
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
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.
|
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
public boolean isMutable()
isMutable
in class IndexSchema
public static void waitForSchemaZkVersionAgreement(String collection, String localCoreNodeName, int schemaZkVersion, ZkController zkController, int maxWaitSecs)
protected static List<String> getActiveReplicaCoreUrls(ZkController zkController, String collection, String localCoreNodeName)
public ManagedIndexSchema addFields(Collection<SchemaField> newFields, Map<String,Collection<String>> copyFieldNames, boolean persist)
IndexSchema
IndexSchema.getSchemaUpdateLock()
.addFields
in class IndexSchema
newFields
- the SchemaFields to addcopyFieldNames
- 0 or more names of targets to copy this field to. The target fields must already exist.persist
- Persist the schema or notIndexSchema.newField(String, String, Map)
public ManagedIndexSchema deleteFields(Collection<String> names)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by
IndexSchema.getSchemaUpdateLock()
.
deleteFields
in class IndexSchema
names
- the names of the fields to deletepublic ManagedIndexSchema replaceField(String fieldName, FieldType replacementFieldType, Map<String,?> replacementArgs)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by IndexSchema.getSchemaUpdateLock()
.
replaceField
in class IndexSchema
fieldName
- The name of the field to be replacedreplacementFieldType
- The field type of the replacement fieldreplacementArgs
- Initialization params for the replacement fieldpublic ManagedIndexSchema addDynamicFields(Collection<SchemaField> newDynamicFields, Map<String,Collection<String>> copyFieldNames, boolean persist)
IndexSchema
IndexSchema.getSchemaUpdateLock()
.addDynamicFields
in class IndexSchema
newDynamicFields
- the SchemaFields to addcopyFieldNames
- 0 or more names of targets to copy this field to. The target fields must already exist.persist
- to persist the schema or notIndexSchema.newDynamicField(String, String, Map)
public ManagedIndexSchema deleteDynamicFields(Collection<String> fieldNamePatterns)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by
IndexSchema.getSchemaUpdateLock()
.
deleteDynamicFields
in class IndexSchema
fieldNamePatterns
- the names of the dynamic fields to deletepublic ManagedIndexSchema replaceDynamicField(String fieldNamePattern, FieldType replacementFieldType, Map<String,?> replacementArgs)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by IndexSchema.getSchemaUpdateLock()
.
replaceDynamicField
in class IndexSchema
fieldNamePattern
- The glob for the dynamic field to be replacedreplacementFieldType
- The field type of the replacement dynamic fieldreplacementArgs
- Initialization params for the replacement dynamic fieldpublic ManagedIndexSchema addCopyFields(Map<String,Collection<String>> copyFields, boolean persist)
IndexSchema
IndexSchema.getSchemaUpdateLock()
.addCopyFields
in class IndexSchema
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 notto limit the number of copied characters.
public ManagedIndexSchema addCopyFields(String source, Collection<String> destinations, int maxChars)
IndexSchema
IndexSchema.getSchemaUpdateLock()
addCopyFields
in class IndexSchema
source
- source field namedestinations
- collection of target field namesmaxChars
- 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.public ManagedIndexSchema deleteCopyFields(Map<String,Collection<String>> copyFields)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by
IndexSchema.getSchemaUpdateLock()
.
deleteCopyFields
in class IndexSchema
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.public ManagedIndexSchema addFieldTypes(List<FieldType> fieldTypeList, boolean persist)
IndexSchema
IndexSchema.getSchemaUpdateLock()
.addFieldTypes
in class IndexSchema
fieldTypeList
- a list of FieldTypes to addpersist
- to persist the schema or notIndexSchema.newFieldType(String, String, Map)
public ManagedIndexSchema deleteFieldTypes(Collection<String> names)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by IndexSchema.getSchemaUpdateLock()
.
deleteFieldTypes
in class IndexSchema
names
- the names of the field types to deletepublic ManagedIndexSchema replaceFieldType(String typeName, String replacementClassName, Map<String,Object> replacementArgs)
IndexSchema
The schema will not be persisted.
Requires synchronizing on the object returned by IndexSchema.getSchemaUpdateLock()
.
replaceFieldType
in class IndexSchema
typeName
- The name of the field type to be replacedreplacementClassName
- The class name of the replacement field typereplacementArgs
- Initialization params for the replacement field typeprotected void postReadInform()
postReadInform
in class IndexSchema
protected void informResourceLoaderAwareObjectsForFieldType(FieldType fieldType)
public SchemaField newField(String fieldName, String fieldType, Map<String,?> options)
IndexSchema
IndexSchema.addField(SchemaField)
.newField
in class IndexSchema
fieldName
- the name of the field to addfieldType
- the field type for the new fieldoptions
- the options to use when creating the SchemaFieldIndexSchema.addField(SchemaField)
public int getSchemaZkVersion()
public SchemaField newDynamicField(String fieldNamePattern, String fieldType, Map<String,?> options)
IndexSchema
IndexSchema.addField(SchemaField)
.newDynamicField
in class IndexSchema
fieldNamePattern
- the pattern for the dynamic field to addfieldType
- the field type for the new fieldoptions
- the options to use when creating the SchemaFieldIndexSchema.addField(SchemaField)
public FieldType newFieldType(String typeName, String className, Map<String,?> options)
IndexSchema
IndexSchema.addFieldTypes(java.util.List, boolean)
.newFieldType
in class IndexSchema
typeName
- the name of the type to addclassName
- the name of the FieldType classoptions
- the options to use when creating the FieldTypeIndexSchema.addFieldTypes(java.util.List, boolean)
protected void informResourceLoaderAwareObjectsInChain(TokenizerChain chain)
public Object getSchemaUpdateLock()
IndexSchema
getSchemaUpdateLock
in class IndexSchema
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.