Search code examples
xmlsolrlucenesolr-schema

What is causing the 'SolrException: Schema Parsing Failed: unknown field' error?


I am attempting to configure a SOLR 4.7.1 single instance, single core setup and on startup SOLR throws an error:

Schema Parsing Failed: unknown field 'INVENTORY_ITEM_ID'. 
Schema file is /var/solr/cores/intota-inventory/schema.xml

I believe SOLR is complaining that the <uniqueKey> has not been defined in schema.xml. I say this because whatever field name I use for <uniqueKey> is displayed in the error message. However, the <uniqueKey> appears to be correctly defined. This is from my schema.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="intota-inventory" version="1.5">
<field name="INVENTORY_ITEM_ID" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<field name="LIBRARY_ID" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<field name="TITLE" type="text_title" indexed="true" stored="true" multiValued="false"/>
<field name="KB_AUTHORS" type="text_simple" indexed="true" stored="true" omitNorms="false"/>
<field name="KB_STANDARD_IDENTIFIER" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="KB_STANDARD_IDENTIFIER_TYPE" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="CALL_NUMBER" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="INVENTORY_ITEM_TYPE_DESCRIPTION" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="INVENTORY_ITEM_STATUS_TYPE_DESCRIPTION" type="string" indexed="true" stored="true" multiValued="false"/>

<uniqueKey>INVENTORY_ITEM_ID</uniqueKey>

I have Googled and tweaked schema.xml for a day now and cannot resolve this seemingly simple error. Does anyone have any idea how to fix this?

Thanks


Solution

  • Before Solr 4.8, fields had to be enclosed in the fields tag and the types in the types tag. Your example does not have those.

    If you have to use Solr 4.7, have a look at the example that come with that specific distribution and you will see the correct definition scopes.

    As it is, your field definitions are just being ignored. But if you do upgrade, they should work.