2013-08-22 55 views
1

希望你能幫助我。我剛剛開始維護的應用程序出現問題。該應用程序使用SOLR進行索引,並且應該使用來自數據庫的數據填充兩個核心。Solr異常:未定義的字段錯誤與重新索引

我不斷收到以下錯誤,當重新建立索引:

2013年8月22日上午10時09分49秒org.apache.solr.common.SolrException登錄

重度:org.apache .solr.common.SolrException:未定義字段: 「editor_id」

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

[...堆棧跟蹤...]

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

我對這個核心的schema.xml:

<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> 

正如你可以看到editor_id存在的模式。在數據庫中,我們從表名的數據被重命名爲editor_user_id。當我將editor_id的schema.xml規則重命名爲editor_user_id時,它仍會返回上述錯誤,就好像schema.xml不相關。

我在這裏丟失了關於如何更新模式以匹配數據庫表的內容嗎?

對於如何擺脫這個錯誤的任何建議將不勝感激,因爲我是一種小菜一碟,當談到SOLR/LUCENE/TOMCAT設置。

謝謝。

編輯:

下面是完整的堆棧跟蹤:

2013年8月22日上午11時47分52秒org.apache.solr.common.SolrException登錄 重度:org.apache.solr .common.SolrException:未定義字段: 「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) 在org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:73) 在org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:201) 在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) org.apache.solr.updat上的 e.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) 在org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:269) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java :235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh (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) 在java.lang.Thread.run(Thread.java:679)

+0

你會粘貼整個堆棧跟蹤:) 當你嘗試運行你的服務器時,你會得到這個錯誤嗎? –

+0

編輯中的堆棧軌跡。我沒有收到這個錯誤,直到我開始重新索引我的'物品'核心。正如你所看到的,模式提到了editor_id。當我將其更改爲例如editor_user_id時,堆棧跟蹤保持不變。 – sn0r

+0

你用什麼過程將數據加載到Solr索引中? DataImportHandler,Custom Code等。你可以顯示該進程的相關部分,因爲它聽起來像需要進行更改以適應數據庫字段名稱的更改。 –

回答

1

您需要重新啓動您的Solr服務器(Tomcat/jetty)以反映solr配置文件(schema.xml,solrconfig.xml)中的任何更改。

+0

到目前爲止,我已經重新啓動每一個變化..沒有幫助。 – sn0r

1

您可能在不同的文件夾中有多個schema.xml文件。

您實際使用的應該以許多不同的方式在solrconfig.xml或solr.xml中指定。 看看是否有更多的schema.xml副本,並最終查看其他文件以檢查對其的引用。

此外,請檢查您是否有主從屬環境,在這種情況下,您可能必須手動將文件複製到主服務器和從屬服務器,和/或指定它需要在複製時複製到solrconfig.xml中。

+0

您還可以在管理員中看到活動模式,例如http:// localhost:8090/solr /#/ webshop/schema –