Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr Error This Indexschema is not mutable

Tags:

solr

solrj

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.

like image 857
Ajay K Avatar asked Jul 30 '15 09:07

Ajay K


People also ask

Where is SOLR schema XML?

The solrconfig. xml file is located in the conf/ directory for each collection. Several well-commented example files can be found in the server/solr/configsets/ directories demonstrating best practices for many different types of installations.


1 Answers

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.

With the updated version of Solr 7.2 you need to the update.autoCreateFields to false in the updateRequestProcessorChain definition in solrconfig.xml.

<updateRequestProcessorChain name="add-unknown-fields-to-the-schema" default="${update.autoCreateFields:false}"                              processor="uuid,remove-blank,field-name-mutating,parse-boolean,parse-long,parse-double,parse-date,add-schema-fields"> 
like image 177
Abhijit Bashetti Avatar answered Sep 18 '22 15:09

Abhijit Bashetti