20

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)
chris544
  • 889
  • 2
  • 10
  • 21
  • 1
    Can you check if your schema file has this line – jay Jun 05 '15 at 18:34
  • 1
    No, there seems to be no such fieldType. – chris544 Jun 05 '15 at 18:36
  • 1
    Are you using SolrCloud? How did you start your servers? Can you check if any of your fields are using the fieldtype booleans? So for example, there might be a field in your schema , if thats the case, then you need to define that fieldType also in your schema – jay Jun 05 '15 at 18:41
  • 1
    I am not using solr server. I start the server simply with "solr start" and create an empty collection (later actions are described in the post, it should be reproducible). There is no occurrence of "booleans" in schema.xml file. – chris544 Jun 05 '15 at 18:47
  • 1
    Can you post the entire error stack trace? – jay Jun 05 '15 at 19:03
  • Posted the stacktrace, but there seems to be a workaround that I found, will post it as an answer in a while. – chris544 Jun 05 '15 at 19:07

3 Answers3

25

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.

Bruno dos Santos
  • 1,361
  • 1
  • 12
  • 21
  • 1
    Yes, this worked. Could you share where you came up with this idea? Or you simply figured out that managed schema and schema.xml have the same format? – chris544 Jun 05 '15 at 19:26
  • 1
    Hi. I noticed that a file named `managed-schema` appeared in my `conf` directory and figured out that it's the same as `schema.xml` file. Thats just a way solr encountered to remove visibility of `schema` file in the Solr API when the `schemaless` mode is set. – Bruno dos Santos Jun 05 '15 at 19:38
  • 3
    Sounds reasonable, but somehow that did not seem that intuitive for me (hadn't used earlier versions and had to migrate an older collection). I hope this helps other frustrated developers. Thanks. – chris544 Jun 05 '15 at 19:42
  • 4
    I am fairly new to solr , can anyone tell how to start solr with ClassicIndexSchemaFactory? – Nilesh Dec 21 '15 at 07:15
  • Take care of comments , they have purpose there. In managed-schema, the comments says "This is the Solr schema file. This file should be named "schema.xml"...blah blah blah – Scott Chu Feb 24 '16 at 03:24
  • 3
    @Nilesh add `` to `solarconfig.xml` in the conf folder – Chris Chevalier Nov 02 '16 at 17:16
  • Did anyone get string and full text fields indexed ? I have boolean and integer fields indexed but string and fulltext fields are not getting indexed. Any thoughts ?. Btw, I used sunspot's schema and solrconfig.xml files. – Pramod Solanky Dec 02 '16 at 10:25
12

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.

Aeolun
  • 756
  • 7
  • 15
  • My data was in xml file and consisted of 5 fields. I only wanted to process 3 fields. I defined those 3 fields in my schema.xml and followed your advice to comment out the section of updateRequestProcessorChain. I didn't work for me. Later I also mentioned the remaining two fields but changed the field properties to index=false, stored=false. Then it worked. – Syed Md Ismail Jan 24 '21 at 07:26
2

Field type {booleans} is not defined in schema.xml.

Steps to fix it,

  • Remove collection
  • Rename the managed-schema file to schema.xml
  • Modify solrconfig.xml to replace the schemaFactory class.
  • a) Remove any ManagedIndexSchemaFactory definition if it exists.
  • b) Add a ClassicIndexSchemaFactory definition as shown below,

<schemaFactory class="ClassicIndexSchemaFactory"/>

  • Update autoCreateFields to false in solrconfig.xml or you will get

This IndexSchema is not mutable error.

${update.autoCreateFields:false}

  • Recreate collection.
Hemant Thorat
  • 2,386
  • 20
  • 14