gpt4 book ai didi

mysql - SOLR mysql DataImport 缺少强制性 uniqueKey 字段 : id

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:35 25 4
gpt4 key购买 nike

我是 SOLR 的新手。使用 DataImporter 将 MySQL 记录引入索引。导入有效,但创建了 0 个文档。我看到以下错误:

org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id

我的 data-config.xml 如下所示:

<dataConfig>  
<dataSource type="JdbcDataSource" driver="org.gjt.mm.mysql.Driver" url="jdbc:mysql://localhost/gartner" user="" password="" batchSize="-1" />
<document name="inquiries">
<entity name="inquiry_data" query="SELECT * FROM research_srv_req">
<field column="reference_id" name="reference_id" />
<field column="type" name="type" />
<field column="sub_type" name="sub_type" />
<field column="subject" name="inquiry_subject" />
<field column="advice" name="advice" />
<field column="client_question" name="client_question" />
<field column="decision_stage_desc" name="decision_stage_desc" />
<field column="acct_name" name="acct_name" />
<field column="acct_sic_type" name="acct_sic_type" />
<field column="acct_sic_sub_type" name="acct_sic_sub_type" />
<field column="enterprise_sic_type" name="enterprise_sic_type" />
<field column="enterprise_sic_sub_type" name="enterprise_sic_sub_type" />
<field column="client_job_title" name="client_job_title" />
</entity>
</document>

并且我将以下内容添加到我的 schema.xml 文件中:

<field name="reference_id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<field name="type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="sub_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="inquiry_subject" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="advice" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="client_question" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="decision_stage" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="acct_name" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="acct_sic_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="acct_sic_sub_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="enterprise_sic_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="enterprise_sic_sub_type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="client_job_title" type="string" indexed="true" stored="true" required="true" multiValued="false" />

原来的 schema.xml 还有下面这行:

<uniqueKey>id</uniqueKey>

我尝试将 id 更改为 reference_id,这是我数据库中的唯一列,但随后 SOLR 无法加载以下堆栈转储:

message {msg=SolrCore 'collection1' is not available due to init failure: Error initializing QueryElevationComponent.,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error initializing QueryElevationComponent. at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:860) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:251) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) 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:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at org.apache.solr.core.SolrCore.(SolrCore.java:835) at org.apache.solr.core.SolrCore.(SolrCore.java:629) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:622) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ... 1 more Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:240) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:601) at org.apache.solr.core.SolrCore.(SolrCore.java:830) ... 13 more Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:387) at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:378) at org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.(QueryElevationComponent.java:136) at org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:309) at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:223) ... 15 more ,code=500} description The server encountered an internal error ({msg=SolrCore 'collection1' is not available due to init failure: Error initializing QueryElevationComponent.,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Error initializing QueryElevationComponent. at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:860) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:251) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) 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:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at org.apache.solr.core.SolrCore.(SolrCore.java:835) at org.apache.solr.core.SolrCore.(SolrCore.java:629) at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:622) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ... 1 more Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent. at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:240) at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:601) at org.apache.solr.core.SolrCore.(SolrCore.java:830) ... 13 more Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:387) at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:378) at org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.(QueryElevationComponent.java:136) at org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:309) at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:223) ... 15 more ,code=500}) that prevented it from fulfilling this request.

我做错了什么?

最佳答案

UniqueKey 需要是一个字符串。你试图让它成为一个整数。尝试将 reference_id 的类型更改为字符串和重新索引。

关于mysql - SOLR mysql DataImport 缺少强制性 uniqueKey 字段 : id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17996408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com