Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using schema.xml instead of managed schema with Solr 5.1.X

Tags:

I am trying to use schema.xml with the latest version of Solr (5.1.0). It seems that by default Solr 5.1.0 uses managed schema, but I would like to use schema.xml for a specific collection.

So I create a new collection (using solr create -c my_collection on windows and copy schema.xml from

server\solr\configsets\basic_configs\conf\schema.xml

to

server\solr\my_collection\conf\schema.xml

After that I change settings in

server\solr\my_collection\conf\solrconfig.xml 

to use

<schemaFactory class="ClassicIndexSchemaFactory"/>

After doing this I get an exception when starting the server:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:    fieldType 'booleans' not found in the schema

Am I doing something terribly wrong here? Should not this kind of logic work?

UPDATE: Stractrace looks like this:

org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:885)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:652)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:518)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:283)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:277)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
at org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactory$TypeMapping.populateValueClasses(AddSchemaFieldsUpdateProcessorFactory.java:244)
at org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactory.inform(AddSchemaFieldsUpdateProcessorFactory.java:170)
at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:620)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:868)
like image 711
chris544 Avatar asked Jun 05 '15 18:06

chris544


People also ask

What is Solr schema XML?

Solr schema file (schema.xml) The Solr search engine uses a schema. xml file to describe the structure of each data index. This XML files determines how Solr will build indexes from input documents, and how to perform index and query time processing. As well as describing the structure of the index, schema.

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.


2 Answers

The problem is that you are referencing a field type booleans that is not defined in your schema.xml file. When you create a core a file managed-schema is created in server\solr\my_collection\conf\. Rename this file to schema.xml and restart solr with ClassicIndexSchemaFactory and it will work fine.

like image 51
Bruno dos Santos Avatar answered Sep 20 '22 13:09

Bruno dos Santos


The problem that I had here was had nothing to do with actually using the booleans field type. The problem was that the newly upgraded solrconfig.xml file has a processor for unknown fields enabled by default, which needs the booleans field type, and probably some others.

These are all defined by default in the new example schema.xml, but quite possibly not in your old schema.xml.

The solution for me was to comment out the <updateRequestProcessorChain name="add-unknown-fields-to-the-schema"> section in solrconfig.xml.

Alternatively, you can probably just replace solrconfig.xml.

like image 44
Aeolun Avatar answered Sep 21 '22 13:09

Aeolun