Solr exception: undefined field error with re-indexing

sn0r picture sn0r · Aug 22, 2013 · Viewed 8.1k times · Source

hoping you can help me. I've got a problem with an application I've just started maintaining. The application uses SOLR for indexing and is supposed to fill two cores with data from a database.

I keep getting the following error when re-indexing:

Aug 22, 2013 10:09:49 AM org.apache.solr.common.SolrException log

SEVERE: org.apache.solr.common.SolrException: undefined field: "editor_id"

    at org.apache.solr.schema.IndexSchema.getField(IndexSchema.java:965)

[... Stack trace ...]

    at java.lang.Thread.run(Thread.java:679)

My schema.xml for this core:

<solrQueryParser defaultOperator="AND" />

<fields>

    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
    <field name="name" type="text_nl" indexed="true" stored="false"/>
    <field name="platform" type="string" indexed="true" stored="false" multiValued="false"/>
    <field name="date" type="date" indexed="true" stored="false" multiValued="false"/>
    <field name="content" type="text_nl" indexed="true" stored="false"/>

    <field name="division_id" type="long" indexed="true" stored="false" multiValued="false"/>
    <field name="division" type="text_nl" indexed="true" stored="false" multiValued="false"/>

    <field name="subdivision_id" type="long" indexed="true" stored="false" multiValued="false"/>
    <field name="subdivision" type="text_nl" indexed="true" stored="false" multiValued="false"/>

    <field name="editor_id" type="long" indexed="true" stored="false" multiValued="false"/>
    <field name="editor" type="text_nl" indexed="true" stored="false" multiValued="false"/>

    <field name="status" type="text_nl" indexed="true" stored="false" multiValued="false"/>
    <field name="status_id" type="long" indexed="true" stored="false" multiValued="false"/>

    <field name="lines" type="text_nl" indexed="true" stored="false" multiValued="true"/>

    <field name="text" type="text_nl" indexed="true" stored="false" multiValued="true"/>

    <field name="_version_" type="long" indexed="true" stored="true"/>

    <field name="suggest_nl" type="text_nl_suggest" indexed="true" stored="true" multiValued="true"/>
    <copyField source="*" dest="suggest_nl"/>

</fields>

<uniqueKey>id</uniqueKey>

As you can see editor_id exists in the schema. In the database we're getting data from the table name's been renamed to editor_user_id. When I rename the schema.xml rule for editor_id to editor_user_id it still comes back with the above error, as if the schema.xml is irrelevant.

Am I missing something here on how to update the schema to match the database table?

Any suggestions for how to get rid of this error would be much appreciated, as I'm kind of a noob when it comes to SOLR/LUCENE/TOMCAT setups.

Thanks.

Edit:

Here's the complete stack trace:

Aug 22, 2013 11:47:52 AM org.apache.solr.common.SolrException log SEVERE: org.apache.solr.common.SolrException: undefined field: "editor_id" at org.apache.solr.schema.IndexSchema.getField(IndexSchema.java:965) at org.apache.solr.schema.IndexSchema.getCopyFieldsList(IndexSchema.java:1077) at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:274) at org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:73) at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:201) at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69) at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51) at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:455) at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:591) at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:350) at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100) at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:246) at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:173) at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92) at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:448) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:269) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:679)

Answer

GS Majumder picture GS Majumder · Aug 22, 2013

You need to restart your solr server(Tomcat/jetty) to reflect any changes in solr configuration files (schema.xml, solrconfig.xml).