public final class ManagedIndexSchema extends IndexSchema
Modifier and Type | Class and Description |
---|---|
class |
ManagedIndexSchema.FieldExistsException |
class |
ManagedIndexSchema.SchemaChangedInZkException |
IndexSchema.DynamicCopy, IndexSchema.DynamicField, IndexSchema.DynamicReplacement
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, name, NAME, 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 |
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.
|
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() . |
protected static List<String> |
getActiveReplicaCoreUrls(ZkController zkController,
String collection,
String localCoreNodeName) |
Object |
getSchemaUpdateLock()
Returns the schema update lock that should be synchronzied 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() |
protected void |
mergeFieldTypesFromZk(Document document,
XPath xpath)
Loads FieldType objects defined in the schema.xml document.
|
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.
|
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, addFieldType, dynamicFieldListToSortedArray, getCopyFieldProperties, getCopyFieldsList, getCopyFieldsMap, getCopySources, getDefaultLuceneMatchVersion, getDefaultSearchFieldName, getDynamicCopyFields, getDynamicFieldPrototypes, getDynamicFields, getDynamicFieldType, getDynamicPattern, getField, getFieldOrNull, getFields, getFieldsWithDefaultValue, getFieldType, getFieldTypeByName, getFieldTypeNoEx, getFieldTypes, getFieldTypeXPathExpressions, getIndexAnalyzer, getNamedPropertyValues, getQueryAnalyzer, getQueryParserDefaultOperator, getRequiredFields, getResourceLoader, getResourceName, getSchemaName, getSimilarity, getSimilarityFactory, getUninversionMap, getUniqueKeyField, getUniqueKeyField, getVersion, hasExplicitField, isCopyFieldTarget, isDuplicateDynField, isDynamicField, isValidDynamicField, loadCopyFields, loadFields, printableUniqueKey, readSchema, refreshAnalyzers, registerCopyField, registerCopyField, registerDynamicFields, 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 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 not or notIndexSchema.newDynamicField(String, String, Map)
public 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 not or notpublic 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 not or notIndexSchema.newFieldType(String, String, Map)
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
protected void mergeFieldTypesFromZk(Document document, XPath xpath) throws XPathExpressionException
document
- Schema XML document where field types are defined.xpath
- Used for evaluating xpath expressions to find field types defined in the schema.xml.XPathExpressionException
- if an error occurs when finding field type elements in the document.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.