3
votes

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)

2
Would you paste the whole stack trace please :) Do you get this error when you try to run your server?Allan Macmillan
Stack trace in the edit. I'm not getting this error any time until I start reindexing my 'items' core. The schema, as you can see, mentions editor_id as a long. When I change this to for example editor_user_id the stack traces remain the same.sn0r
What process are you using to load the data into the Solr Index? DataImportHandler, Custom Code, etc. Can you show the relevant parts of that process as it sounds like a change is required there to accommodate the change in your database field name.Paige Cook
were you able to figure out the root cause?Sid

2 Answers

1
votes

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

1
votes

You may have more than one schema.xml file in different folders.

The one you are actually used should be specified in your solrconfig.xml or solr.xml in many different ways. Have a look if you have more copies of the schema.xml and eventually have a look at those other files to check for a reference to it.

Also check if you have a master slave environment, in which case you may have to manually copy your file to the master and the slave servers, and/or specify that it needs to be copied at replication time in the in your solrconfig.xml.