Class IndexSchema
- java.lang.Object
- 
- org.apache.solr.schema.IndexSchema
 
- 
- Direct Known Subclasses:
- ManagedIndexSchema
 
 public class IndexSchema extends Object IndexSchemacontains information about the valid fields in an index and the types of those fields.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classIndexSchema.DynamicCopystatic classIndexSchema.DynamicFieldstatic classIndexSchema.DynamicReplacementstatic classIndexSchema.SchemaProps
 - 
Field Summary
 - 
Constructor SummaryConstructors Modifier Constructor Description IndexSchema(String name, ConfigSetService.ConfigResource schemaResource, org.apache.lucene.util.Version luceneVersion, SolrResourceLoader resourceLoader, Properties substitutableProperties)Constructs a schema using the specified resource name and stream.protectedIndexSchema(org.apache.lucene.util.Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexSchemaaddCopyFields(String source, Collection<String> destinations, int maxChars)Copies this schema and adds the new copy fields to the copy.IndexSchemaaddCopyFields(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 bygetSchemaUpdateLock().IndexSchemaaddDynamicFields(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 bygetSchemaUpdateLock().IndexSchemaaddField(SchemaField newField)IndexSchemaaddField(SchemaField newField, boolean persist)Copies this schema, adds the given field to the copy Requires synchronizing on the object returned bygetSchemaUpdateLock().IndexSchemaaddField(SchemaField newField, Collection<String> copyFieldNames)Copies this schema, adds the given field to the copy Requires synchronizing on the object returned bygetSchemaUpdateLock().IndexSchemaaddFields(Collection<SchemaField> newFields)Copies this schema, adds the given fields to the copy.IndexSchemaaddFields(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 bygetSchemaUpdateLock().IndexSchemaaddFieldTypes(List<FieldType> fieldTypeList, boolean persist)Copies this schema, adds the given field type to the copy, Requires synchronizing on the object returned bygetSchemaUpdateLock().IndexSchemadeleteCopyFields(Map<String,Collection<String>> copyFields)Copies this schema and deletes the given copy fields from the copy.IndexSchemadeleteDynamicFields(Collection<String> fieldNamePatterns)Copies this schema, deletes the named dynamic fields from the copy.IndexSchemadeleteFields(Collection<String> names)Copies this schema, deletes the named fields from the copy.IndexSchemadeleteFieldTypes(Collection<String> names)Copies this schema, deletes the named field types from the copy.protected static IndexSchema.DynamicField[]dynamicFieldListToSortedArray(List<IndexSchema.DynamicField> dynamicFieldList)Sort the dynamic fields and stuff them in a normal array for faster access.List<org.apache.solr.common.util.SimpleOrderedMap<Object>>getCopyFieldProperties(boolean showDetails, Set<String> requestedSourceFields, Set<String> requestedDestinationFields)Returns a list of copyField directives, with optional details and optionally restricting to those directives that contain the requested source and/or destination field names.List<CopyField>getCopyFieldsList(String sourceField)Get all copy fields for a specified source field, both static and dynamic ones.Map<String,List<CopyField>>getCopyFieldsMap()List<String>getCopySources(String destField)Get all copy fields, both the static and the dynamic ones.org.apache.lucene.util.VersiongetDefaultLuceneMatchVersion()The Default Lucene Match Version for this IndexSchemaIndexSchema.DynamicCopy[]getDynamicCopyFields()SchemaField[]getDynamicFieldPrototypes()IndexSchema.DynamicField[]getDynamicFields()FieldTypegetDynamicFieldType(String fieldName)Returns the FieldType of the best matching dynamic field for the specified field nameStringgetDynamicPattern(String fieldName)SchemaFieldgetField(String fieldName)Returns the SchemaField that should be used for the specified field nameSchemaFieldgetFieldOrNull(String fieldName)Returns the SchemaField that should be used for the specified field name, or null if none exists.Map<String,SchemaField>getFields()Provides direct access to the Map containing all explicit (ie: non-dynamic) fields in the index, keyed on field name.List<SchemaField>getFieldsWithDefaultValue()Provides direct access to the List containing all fields with a default valueFieldTypegetFieldType(String fieldName)Returns the FieldType for the specified field name.FieldTypegetFieldTypeByName(String fieldTypeName)Given the name of aFieldType(not to be confused withgetFieldType(String)which takes in the name of a field), return theFieldType.FieldTypegetFieldTypeNoEx(String fieldName)Returns the FieldType for the specified field name.Map<String,FieldType>getFieldTypes()Provides direct access to the Map containing all Field Types in the index, keyed on field type name.org.apache.lucene.analysis.AnalyzergetIndexAnalyzer()Returns the Analyzer used when indexing documents for this indexMap<String,Object>getNamedPropertyValues()Get a map of property name -> value for the whole schema.Map<String,Object>getNamedPropertyValues(String name, org.apache.solr.common.params.SolrParams params)org.apache.lucene.queries.payloads.PayloadDecodergetPayloadDecoder(String field)org.apache.lucene.analysis.AnalyzergetQueryAnalyzer()Returns the Analyzer used when searching this indexCollection<SchemaField>getRequiredFields()Provides direct access to the List containing all required fields.SolrResourceLoadergetResourceLoader()The resource loader to be used to load components related to the schema when the schema is loading / initialising.StringgetResourceName()Gets the name of the resource used to instantiate this schema.StringgetSchemaName()Gets the name of the schema as specified in the schema resource.ObjectgetSchemaUpdateLock()Returns the schema update lock that should be synchronized on to update the schema.org.apache.lucene.search.similarities.SimilaritygetSimilarity()Returns the Similarity used for this indexSimilarityFactorygetSimilarityFactory()Returns the SimilarityFactory that constructed the Similarity for this indexorg.apache.solr.common.cloud.SolrClassLoadergetSolrClassLoader()Function<String,UninvertingReader.Type>getUninversionMapper()SchemaFieldgetUniqueKeyField()Unique Key field specified in the schema fileorg.apache.lucene.index.IndexableFieldgetUniqueKeyField(org.apache.lucene.document.Document doc)The raw (field type encoded) value of the Unique Key field for the specified DocumentfloatgetVersion()booleanhasExplicitField(String fieldName)Does the schema explicitly define the specified field, i.e.org.apache.lucene.util.BytesRefindexableUniqueKey(String idStr)Given a readable/printable uniqueKey value, return an indexable versionbooleanisCopyFieldTarget(SchemaField f)Check if a field is used as the destination of a copyField operationprotected booleanisDuplicateDynField(List<IndexSchema.DynamicField> dFields, SchemaField f)booleanisDynamicField(String fieldName)Is the specified field dynamic or not.booleanisMutable()booleanisUsableForChildDocs()Helper method that returnstrueif theROOT_FIELD_NAMEuses the exact same 'type' as thegetUniqueKeyField()protected booleanisValidDynamicField(List<IndexSchema.DynamicField> dFields, SchemaField f)protected static booleanisValidFieldGlob(String name)Returns true if the given name has exactly one asterisk either at the start or end of the nameprotected voidloadCopyFields(org.apache.solr.common.ConfigNode n)Loads the copy fieldsprotected Map<String,Boolean>loadFields(org.apache.solr.common.ConfigNode n)Loads fields and dynamic fields.SchemaFieldnewDynamicField(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.SchemaFieldnewField(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.FieldTypenewFieldType(String typeName, String className, Map<String,?> options)Returns a FieldType if the given typeName does not already exist in this schema.protected voidpostReadInform()StringprintableUniqueKey(org.apache.lucene.document.Document doc)The printable value of the Unique Key field for the specified DocumentStringprintableUniqueKey(org.apache.lucene.util.BytesRef idBytes)Given an indexable uniqueKey value, return the readable/printable versionStringprintableUniqueKey(org.apache.solr.common.SolrDocument solrDoc)StringprintableUniqueKey(org.apache.solr.common.SolrInputDocument solrDoc)protected voidreadSchema(ConfigSetService.ConfigResource is)voidrefreshAnalyzers()This will re-create the Analyzers.voidregisterCopyField(String source, String dest)voidregisterCopyField(String source, String dest, int maxChars)NOTE: this function is not thread safe.voidregisterDynamicFields(SchemaField... fields)Register one or more new Dynamic Fields with the Schema.protected voidregisterExplicitSrcAndDestFields(String source, int maxChars, SchemaField destSchemaField, SchemaField sourceSchemaField)ManagedIndexSchemareplaceDynamicField(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.IndexSchemareplaceField(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.IndexSchemareplaceFieldType(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.voidsetResourceName(String resourceName)Sets the name of the resource used to instantiate this schema.
 
- 
- 
- 
Field Detail- 
COPY_FIELDpublic static final String COPY_FIELD - See Also:
- Constant Field Values
 
 - 
COPY_FIELDSpublic static final String COPY_FIELDS - See Also:
- Constant Field Values
 
 - 
DEFAULT_SCHEMA_FILEpublic static final String DEFAULT_SCHEMA_FILE - See Also:
- Constant Field Values
 
 - 
DESTINATIONpublic static final String DESTINATION - See Also:
- Constant Field Values
 
 - 
DYNAMIC_FIELDpublic static final String DYNAMIC_FIELD - See Also:
- Constant Field Values
 
 - 
DYNAMIC_FIELDSpublic static final String DYNAMIC_FIELDS - See Also:
- Constant Field Values
 
 - 
FIELDpublic static final String FIELD - See Also:
- Constant Field Values
 
 - 
FIELDSpublic static final String FIELDS - See Also:
- Constant Field Values
 
 - 
FIELD_TYPEpublic static final String FIELD_TYPE - See Also:
- Constant Field Values
 
 - 
FIELD_TYPESpublic static final String FIELD_TYPES - See Also:
- Constant Field Values
 
 - 
INTERNAL_POLY_FIELD_PREFIXpublic static final String INTERNAL_POLY_FIELD_PREFIX - See Also:
- Constant Field Values
 
 - 
LUCENE_MATCH_VERSION_PARAMpublic static final String LUCENE_MATCH_VERSION_PARAM - See Also:
- Constant Field Values
 
 - 
MAX_CHARSpublic static final String MAX_CHARS - See Also:
- Constant Field Values
 
 - 
NAMEpublic static final String NAME - See Also:
- Constant Field Values
 
 - 
NEST_PARENT_FIELD_NAMEpublic static final String NEST_PARENT_FIELD_NAME - See Also:
- Constant Field Values
 
 - 
NEST_PATH_FIELD_NAMEpublic static final String NEST_PATH_FIELD_NAME - See Also:
- Constant Field Values
 
 - 
REQUIREDpublic static final String REQUIRED - See Also:
- Constant Field Values
 
 - 
SCHEMApublic static final String SCHEMA - See Also:
- Constant Field Values
 
 - 
SIMILARITYpublic static final String SIMILARITY - See Also:
- Constant Field Values
 
 - 
SOURCEpublic static final String SOURCE - See Also:
- Constant Field Values
 
 - 
TYPEpublic static final String TYPE - See Also:
- Constant Field Values
 
 - 
TYPESpublic static final String TYPES - See Also:
- Constant Field Values
 
 - 
ROOT_FIELD_NAMEpublic static final String ROOT_FIELD_NAME - See Also:
- Constant Field Values
 
 - 
UNIQUE_KEYpublic static final String UNIQUE_KEY - See Also:
- Constant Field Values
 
 - 
VERSIONpublic static final String VERSION - See Also:
- Constant Field Values
 
 - 
resourceNameprotected String resourceName 
 - 
nameprotected String name 
 - 
luceneVersionprotected final org.apache.lucene.util.Version luceneVersion 
 - 
versionprotected float version 
 - 
loaderprotected final SolrResourceLoader loader 
 - 
solrClassLoaderprotected final org.apache.solr.common.cloud.SolrClassLoader solrClassLoader 
 - 
substitutablePropertiesprotected final Properties substitutableProperties 
 - 
fieldsprotected Map<String,SchemaField> fields 
 - 
fieldsWithDefaultValueprotected List<SchemaField> fieldsWithDefaultValue 
 - 
requiredFieldsprotected Collection<SchemaField> requiredFields 
 - 
dynamicFieldsprotected IndexSchema.DynamicField[] dynamicFields 
 - 
dynamicFieldCacheprotected org.apache.solr.common.util.Cache<String,SchemaField> dynamicFieldCache 
 - 
schemaAwareprotected List<SchemaAware> schemaAware 
 - 
dynamicCopyFieldsprotected IndexSchema.DynamicCopy[] dynamicCopyFields 
 - 
copyFieldTargetCountsprotected Map<SchemaField,Integer> copyFieldTargetCounts keys are all fields copied to, count is num of copyField directives that target them.
 - 
similarityprotected org.apache.lucene.search.similarities.Similarity similarity 
 - 
similarityFactoryprotected SimilarityFactory similarityFactory 
 - 
isExplicitSimilarityprotected boolean isExplicitSimilarity 
 - 
uniqueKeyFieldprotected SchemaField uniqueKeyField 
 - 
uniqueKeyFieldNameprotected String uniqueKeyFieldName 
 - 
uniqueKeyFieldTypeprotected FieldType uniqueKeyFieldType 
 
- 
 - 
Constructor Detail- 
IndexSchemapublic IndexSchema(String name, ConfigSetService.ConfigResource schemaResource, org.apache.lucene.util.Version luceneVersion, SolrResourceLoader resourceLoader, Properties substitutableProperties) Constructs a schema using the specified resource name and stream. By default, this follows the normal config path directory searching rules.
 - 
IndexSchemaprotected IndexSchema(org.apache.lucene.util.Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties)
 
- 
 - 
Method Detail- 
getDynamicFieldspublic IndexSchema.DynamicField[] getDynamicFields() 
 - 
getDynamicCopyFieldspublic IndexSchema.DynamicCopy[] getDynamicCopyFields() 
 - 
getResourceLoaderpublic SolrResourceLoader getResourceLoader() The resource loader to be used to load components related to the schema when the schema is loading / initialising. It should not be used for any other purpose or time; considerSolrCore.getResourceLoader()instead.- Since:
- solr 1.4
 
 - 
getResourceNamepublic String getResourceName() Gets the name of the resource used to instantiate this schema.
 - 
getSolrClassLoaderpublic org.apache.solr.common.cloud.SolrClassLoader getSolrClassLoader() 
 - 
setResourceNamepublic void setResourceName(String resourceName) Sets the name of the resource used to instantiate this schema.
 - 
getSchemaNamepublic String getSchemaName() Gets the name of the schema as specified in the schema resource.
 - 
getDefaultLuceneMatchVersionpublic org.apache.lucene.util.Version getDefaultLuceneMatchVersion() The Default Lucene Match Version for this IndexSchema
 - 
getVersionpublic float getVersion() 
 - 
getFieldspublic Map<String,SchemaField> getFields() Provides direct access to the Map containing all explicit (ie: non-dynamic) fields in the index, keyed on field name.Modifying this Map (or any item in it) will affect the real schema NOTE: this function is not thread safe. However, it is safe to use within the standard inform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException
 - 
getFieldTypespublic Map<String,FieldType> getFieldTypes() Provides direct access to the Map containing all Field Types in the index, keyed on field type name.Modifying this Map (or any item in it) will affect the real schema. However if you make any modifications, be sure to call refreshAnalyzers()to update the Analyzers for the registered fields.NOTE: this function is not thread safe. However, it is safe to use within the standard inform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException
 - 
getFieldsWithDefaultValuepublic List<SchemaField> getFieldsWithDefaultValue() Provides direct access to the List containing all fields with a default value
 - 
getRequiredFieldspublic Collection<SchemaField> getRequiredFields() Provides direct access to the List containing all required fields. This list contains all fields with default values.
 - 
getSimilaritypublic org.apache.lucene.search.similarities.Similarity getSimilarity() Returns the Similarity used for this index
 - 
getSimilarityFactorypublic SimilarityFactory getSimilarityFactory() Returns the SimilarityFactory that constructed the Similarity for this index
 - 
getIndexAnalyzerpublic org.apache.lucene.analysis.Analyzer getIndexAnalyzer() Returns the Analyzer used when indexing documents for this indexThis Analyzer is field (and dynamic field) name aware, and delegates to a field specific Analyzer based on the field type. 
 - 
getQueryAnalyzerpublic org.apache.lucene.analysis.Analyzer getQueryAnalyzer() Returns the Analyzer used when searching this indexThis Analyzer is field (and dynamic field) name aware, and delegates to a field specific Analyzer based on the field type. 
 - 
getUniqueKeyFieldpublic SchemaField getUniqueKeyField() Unique Key field specified in the schema file- Returns:
- null if this schema has no unique key field
 
 - 
getUniqueKeyFieldpublic org.apache.lucene.index.IndexableField getUniqueKeyField(org.apache.lucene.document.Document doc) The raw (field type encoded) value of the Unique Key field for the specified Document- Returns:
- null if this schema has no unique key field
- See Also:
- printableUniqueKey(org.apache.lucene.document.Document)
 
 - 
printableUniqueKeypublic String printableUniqueKey(org.apache.lucene.document.Document doc) The printable value of the Unique Key field for the specified Document- Returns:
- null if this schema has no unique key field
 
 - 
printableUniqueKeypublic String printableUniqueKey(org.apache.solr.common.SolrDocument solrDoc) 
 - 
printableUniqueKeypublic String printableUniqueKey(org.apache.solr.common.SolrInputDocument solrDoc) 
 - 
printableUniqueKeypublic String printableUniqueKey(org.apache.lucene.util.BytesRef idBytes) Given an indexable uniqueKey value, return the readable/printable version
 - 
indexableUniqueKeypublic org.apache.lucene.util.BytesRef indexableUniqueKey(String idStr) Given a readable/printable uniqueKey value, return an indexable version
 - 
refreshAnalyzerspublic void refreshAnalyzers() This will re-create the Analyzers. If you make any modifications to the Field map (getFields(), this function is required to synch the internally cached field analyzers.- Since:
- solr 1.3
 
 - 
getUninversionMapperpublic Function<String,UninvertingReader.Type> getUninversionMapper() - See Also:
- UninvertingReader
 
 - 
isMutablepublic boolean isMutable() 
 - 
readSchemaprotected void readSchema(ConfigSetService.ConfigResource is) 
 - 
postReadInformprotected void postReadInform() 
 - 
loadFieldsprotected Map<String,Boolean> loadFields(org.apache.solr.common.ConfigNode n) Loads fields and dynamic fields.- Returns:
- a map from field name to explicit required value
 
 - 
dynamicFieldListToSortedArrayprotected static IndexSchema.DynamicField[] dynamicFieldListToSortedArray(List<IndexSchema.DynamicField> dynamicFieldList) Sort the dynamic fields and stuff them in a normal array for faster access.
 - 
loadCopyFieldsprotected void loadCopyFields(org.apache.solr.common.ConfigNode n) Loads the copy fields
 - 
isValidFieldGlobprotected static boolean isValidFieldGlob(String name) Returns true if the given name has exactly one asterisk either at the start or end of the name
 - 
isValidDynamicFieldprotected boolean isValidDynamicField(List<IndexSchema.DynamicField> dFields, SchemaField f) 
 - 
registerDynamicFieldspublic void registerDynamicFields(SchemaField... fields) Register one or more new Dynamic Fields with the Schema.- Parameters:
- fields- The sequence of- SchemaField
 
 - 
isDuplicateDynFieldprotected boolean isDuplicateDynField(List<IndexSchema.DynamicField> dFields, SchemaField f) 
 - 
registerCopyFieldpublic void registerCopyField(String source, String dest, int maxChars) NOTE: this function is not thread safe. However, it is safe to use within the standardinform( SolrCore core )function forSolrCoreAwareclasses. Outsideinform, this could potentially throw a ConcurrentModificationException- See Also:
- SolrCoreAware
 
 - 
registerExplicitSrcAndDestFieldsprotected void registerExplicitSrcAndDestFields(String source, int maxChars, SchemaField destSchemaField, SchemaField sourceSchemaField) 
 - 
getDynamicFieldPrototypespublic SchemaField[] getDynamicFieldPrototypes() 
 - 
hasExplicitFieldpublic boolean hasExplicitField(String fieldName) Does the schema explicitly define the specified field, i.e. not as a result of a copyField declaration? We consider it explicitly defined if it matches a field name or a dynamicField name.- Returns:
- true if explicitly declared in the schema.
 
 - 
isDynamicFieldpublic boolean isDynamicField(String fieldName) Is the specified field dynamic or not.- Returns:
- true if the specified field is dynamic
 
 - 
getFieldOrNullpublic SchemaField getFieldOrNull(String fieldName) Returns the SchemaField that should be used for the specified field name, or null if none exists.- Parameters:
- fieldName- may be an explicitly defined field or a name that matches a dynamic field.
- Returns:
- The SchemaField
- See Also:
- getFieldType(java.lang.String),- getField(String)
 
 - 
getFieldpublic SchemaField getField(String fieldName) Returns the SchemaField that should be used for the specified field name- Parameters:
- fieldName- may be an explicitly defined field or a name that matches a dynamic field.
- Returns:
- The SchemaField
- Throws:
- org.apache.solr.common.SolrException- if no such field exists
- See Also:
- getFieldType(java.lang.String),- getFieldOrNull(String)
 
 - 
getFieldTypepublic FieldType getFieldType(String fieldName) Returns the FieldType for the specified field name.This method exists because it can be more efficient then getField(java.lang.String)for dynamic fields if a full SchemaField isn't needed.- Parameters:
- fieldName- may be an explicitly created field, or a name that excercises a dynamic field.
- Throws:
- org.apache.solr.common.SolrException- if no such field exists
- See Also:
- getField(String),- getFieldTypeNoEx(java.lang.String)
 
 - 
getFieldTypeByNamepublic FieldType getFieldTypeByName(String fieldTypeName) Given the name of aFieldType(not to be confused withgetFieldType(String)which takes in the name of a field), return theFieldType.
 - 
getFieldTypeNoExpublic FieldType getFieldTypeNoEx(String fieldName) Returns the FieldType for the specified field name.This method exists because it can be more efficient then getField(java.lang.String)for dynamic fields if a full SchemaField isn't needed.- Parameters:
- fieldName- may be an explicitly created field, or a name that exercises a dynamic field.
- Returns:
- null if field is not defined.
- See Also:
- getField(String),- getFieldTypeNoEx(java.lang.String)
 
 - 
getDynamicFieldTypepublic FieldType getDynamicFieldType(String fieldName) Returns the FieldType of the best matching dynamic field for the specified field name- Parameters:
- fieldName- may be an explicitly created field, or a name that exercises a dynamic field.
- Throws:
- org.apache.solr.common.SolrException- if no such field exists
- See Also:
- getField(String),- getFieldTypeNoEx(java.lang.String)
 
 - 
getCopySourcespublic List<String> getCopySources(String destField) Get all copy fields, both the static and the dynamic ones.- Returns:
- Array of fields copied into this field
 
 - 
getCopyFieldsListpublic List<CopyField> getCopyFieldsList(String sourceField) Get all copy fields for a specified source field, both static and dynamic ones.- Returns:
- List of CopyFields to copy to.
- Since:
- solr 1.4
 
 - 
isCopyFieldTargetpublic boolean isCopyFieldTarget(SchemaField f) Check if a field is used as the destination of a copyField operation- Since:
- solr 1.3
 
 - 
getNamedPropertyValuespublic Map<String,Object> getNamedPropertyValues() Get a map of property name -> value for the whole schema.
 - 
getNamedPropertyValuespublic Map<String,Object> getNamedPropertyValues(String name, org.apache.solr.common.params.SolrParams params) 
 - 
getCopyFieldPropertiespublic List<org.apache.solr.common.util.SimpleOrderedMap<Object>> getCopyFieldProperties(boolean showDetails, Set<String> requestedSourceFields, Set<String> requestedDestinationFields) Returns a list of copyField directives, with optional details and optionally restricting to those directives that contain the requested source and/or destination field names.- Parameters:
- showDetails- If true, source and destination dynamic bases, and explicit fields matched by source globs, will be added to dynamic copyField directives where appropriate
- requestedSourceFields- If not null, output is restricted to those copyField directives with the requested source field names
- requestedDestinationFields- If not null, output is restricted to those copyField directives with the requested destination field names
- Returns:
- a list of copyField directives
 
 - 
addFieldpublic IndexSchema addField(SchemaField newField, boolean persist) Copies this schema, adds the given field to the copy Requires synchronizing on the object returned bygetSchemaUpdateLock().- Parameters:
- newField- the SchemaField to add
- persist- to persist the schema or not
- Returns:
- a new IndexSchema based on this schema with newField added
- See Also:
- newField(String, String, Map)
 
 - 
addFieldpublic IndexSchema addField(SchemaField newField) 
 - 
addFieldpublic IndexSchema addField(SchemaField newField, Collection<String> copyFieldNames) Copies this schema, adds the given field to the copy Requires synchronizing on the object returned bygetSchemaUpdateLock().- Parameters:
- newField- the SchemaField to add
- copyFieldNames- 0 or more names of targets to copy this field to. The targets must already exist.
- Returns:
- a new IndexSchema based on this schema with newField added
- See Also:
- newField(String, String, Map)
 
 - 
addFieldspublic IndexSchema addFields(Collection<SchemaField> newFields) Copies this schema, adds the given fields to the copy. Requires synchronizing on the object returned bygetSchemaUpdateLock().- Parameters:
- newFields- the SchemaFields to add
- Returns:
- a new IndexSchema based on this schema with newFields added
- See Also:
- newField(String, String, Map)
 
 - 
addFieldspublic IndexSchema 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 bygetSchemaUpdateLock().- 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:
- newField(String, String, Map)
 
 - 
deleteFieldspublic IndexSchema deleteFields(Collection<String> names) Copies this schema, deletes the named fields from the copy.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- Parameters:
- names- the names of the fields to delete
- Returns:
- a new IndexSchema based on this schema with the named fields deleted
 
 - 
replaceFieldpublic IndexSchema 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.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- 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
 
 - 
addDynamicFieldspublic IndexSchema 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 bygetSchemaUpdateLock().- 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:
- newDynamicField(String, String, Map)
 
 - 
deleteDynamicFieldspublic IndexSchema deleteDynamicFields(Collection<String> fieldNamePatterns) Copies this schema, deletes the named dynamic fields from the copy.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- Parameters:
- fieldNamePatterns- the names of the dynamic fields to delete
- Returns:
- a new IndexSchema based on this schema with the named dynamic fields deleted
 
 - 
replaceDynamicFieldpublic 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.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- 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
 
 - 
addCopyFieldspublic IndexSchema 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 bygetSchemaUpdateLock().- 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.
 
 - 
addCopyFieldspublic IndexSchema addCopyFields(String source, Collection<String> destinations, int maxChars) Copies this schema and adds the new copy fields to the copy.Requires synchronizing on the object returned by getSchemaUpdateLock()- 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.UNLIMITEDif you don't want to limit the number of copied chars.
- Returns:
- The new Schema with the copy fields added
 
 - 
deleteCopyFieldspublic IndexSchema deleteCopyFields(Map<String,Collection<String>> copyFields) 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 getSchemaUpdateLock().- 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
 
 - 
newFieldpublic 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. The resulting SchemaField can be used in a call toaddField(SchemaField).- 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:
- addField(SchemaField)
 
 - 
newDynamicFieldpublic 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. The resulting SchemaField can be used in a call toaddField(SchemaField).- 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:
- addField(SchemaField)
 
 - 
getSchemaUpdateLockpublic Object getSchemaUpdateLock() Returns the schema update lock that should be synchronized on to update the schema. Only applicable to mutable schemas.- Returns:
- the schema update lock object to synchronize on
 
 - 
addFieldTypespublic IndexSchema addFieldTypes(List<FieldType> fieldTypeList, boolean persist) Copies this schema, adds the given field type to the copy, Requires synchronizing on the object returned bygetSchemaUpdateLock().- 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:
- newFieldType(String, String, Map)
 
 - 
deleteFieldTypespublic IndexSchema deleteFieldTypes(Collection<String> names) Copies this schema, deletes the named field types from the copy.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- Parameters:
- names- the names of the field types to delete
- Returns:
- a new IndexSchema based on this schema with the named field types deleted
 
 - 
replaceFieldTypepublic IndexSchema 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.The schema will not be persisted. Requires synchronizing on the object returned by getSchemaUpdateLock().- 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
 
 - 
newFieldTypepublic FieldType newFieldType(String typeName, String className, Map<String,?> options) Returns a FieldType if the given typeName does not already exist in this schema. The resulting FieldType can be used in a call toaddFieldTypes(java.util.List, boolean).- 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:
- addFieldTypes(java.util.List, boolean)
 
 - 
isUsableForChildDocspublic boolean isUsableForChildDocs() Helper method that returnstrueif theROOT_FIELD_NAMEuses the exact same 'type' as thegetUniqueKeyField()- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
 
 - 
getPayloadDecoderpublic org.apache.lucene.queries.payloads.PayloadDecoder getPayloadDecoder(String field) 
 
- 
 
-