What is Managed Schema

Any Solr collection constitutes of two parts - the configuration files to use and the distributed index which refers to the configuration files.

 

There are lots of configuration files which are used to define each collection each having it’s defined job. For example the solrconfig.xml file for defining search configurations , the schema.xml file to define the schema for the incoming fields in the documents which need to be indexed. There are more files of course like the stopwords.txt file. All of these files combine to form a configuration set which the collection refers to.

 

SolrCloud users who need to modify any setting, for example adding a new field have to use the following four steps for their change to take affect

  1. Download their previous configuration set from ZooKeeper
  2. Make changes to their configuration set locally adding fields, modifying synonyms etc.
  3. Upload the configuration set to ZooKeeper again
  4. Call a Collection RELOAD command for the collection to notice the changes you just made.

 

Solr now has REST like APIs to make all of these changes easier for you. So you could use the Config APIs ( https://cwiki.apache.org/confluence/display/solr/Config+API ) to make changes to the solrconfig.xml file , the Schema APIs to make changes to the schema ( https://cwiki.apache.org/confluence/display/solr/Schema+API ) . You can add fields from the Solr Admin UI if you would like too!

 

The Config APIs are always enabled so you could start using it in any recent release of Solr ( 5.3.1 and above is recommended ) . The feature where you can add fields from the Solr Admin UI is can be used from Solr 5.4 onwards and uses the Schema APIs under the hood.

 

To make all this consistent we decided that the Schema APIs should be enabled by default . This does NOT enable schemaless mode, only enables one to use Schema APIs. To enable it yourself you can can follow the instruction here - https://cwiki.apache.org/confluence/display/solr/Managed+Schema+Definition+in+SolrConfig .

In all our current example configuration that we ship, starting Solr 5.5 they will use the ManagedIndexSchemaFactory instead of the ClassicIndexSchemaFactory. To make this change more apparent the schema.xml file has been renamed to managed-schema . So don’t be surprised!

 

If you don’t like this behaviour and want to hand edit your files, then the ClassicIndexSchemaFactory is not going anywhere . You can specify it explicitly in your solrconfig.xml file and rename managed-schema to schema.xml ( when Solr is not running ) to get back the old behaviour.


With Solr 6.0 if you haven’t specified a schemaFactory in the solrconfig.xml file then ManagedIndexSchemaFactory will be used as opposed to ClassicIndexSchemaFactory and the schema file will be automatically renamed from schema.xml to managed-schema

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk