Solr Error This Indexschema is not mutable

Ajay K picture Ajay K · Jul 30, 2015 · Viewed 10.1k times · Source

I want to use the schema.xml rather than the managed schema so I changed the following in the solrconfig.xml to the below

<schemaFactory class="ManagedIndexSchemaFactory">
    <bool name="mutable">true</bool>
    <str name="managedSchemaResourceName">managed-schema</str>
  </schemaFactory>

to

<schemaFactory class="ClassicIndexSchemaFactory"/> 

But I get The indexschema is not mutable error when I try to Index a flat file using the post command.

Answer

Abhijit Bashetti picture Abhijit Bashetti · Jul 30, 2015

Remove the AddSchemaFieldsUpdateProcessorFactory section from the updateRequestProcessorChain config in your solrconfig.xml

The schemaFactory option in solrconfig.xml. This controls whether the Schema should be defined as a "managed index schema": schema modification is only possible through the Schema API. By default, if no schemaFactory is specified, then the default behavior is to use the "ClassicIndexSchemaFactory"

The ClassicIndexSchemaFactory requires the use of a schema.xml file, which can be edited manually and is only loaded only when the collection is loaded. This setting disallows Schema API methods that modify the schema.

When ManagedIndexSchemaFactory is specified instead, Solr will load the schema from he resource named in managedSchemaResourceName, rather than from schema.xml.

AddSchemaFieldsUpdateProcessorFactory : This processor will dynamically add fields to the schema if an input document contains one or more fields that don't match any field or dynamic field in the schema.

read more on the same here https://lucene.apache.org/solr/4_6_0/solr-core/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactory.html

In short the above process factory is used for managed schema. When one does not want to use ManagedIndexSchemaFactory it should be removed from the updateRequestProcessorChain.

For more details of it you can check out the solr code or read the source code of the AddSchemaFieldsUpdateProcessorFactory.java Debug the method processAdd(AddUpdateCommand cm) , will help more on the same.