SOLR:文档缺少必需的uniqueKey字段:id

时间:2017-06-06 13:27:30

标签: oracle11g solr6

我刚开始使用solr-6.5.1,尝试从Oracle DB导入数据。 我的数据没有任何唯一ID,通过各种论坛搜索并发现使用class =“solr.UUIDUpdateProcessorFactory”这可以解决。但是仍然得到同样的错误。下面是我的托管架构和solrconfig.xml的片段。

solrconfig.xml中

<requestHandler name="/update" class="solr.UpdateRequestHandler">
        <lst name="defaults">
            <str name="update.chain">uuid</str>
        </lst>
    </requestHandler>

    <updateRequestProcessorChain name="uuid">
        <processor class="solr.UUIDUpdateProcessorFactory">
            <str name="fieldName">id</str>
        </processor>
        <processor class="solr.RunUpdateProcessorFactory" />
    </updateRequestProcessorChain>

管理型模式

<field name="id" type="uuid" indexed="true" stored="true" required="true" />
    <field name="SERVICEACCOUNTNUMBER" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="USERNAME" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="NAME" type="string" indexed="true" stored="true"  multiValued="false" />
    <field name="TRANSACTION_DATE" type="date" indexed="true" stored="true"  />
    <field name="PROCESSSTATUS" type="string" indexed="true" stored="true" />
    <field name="RECHARGE_MODE" type="string" indexed="true" stored="true"  />
    <field name="PROCESSRECHARGEREQUESTNO" type="string" indexed="true" stored="true"  />
    <field name="PACKAGE_ID" type="string" indexed="true" stored="true"  />
    <field name="PACKAGENAME" type="string" indexed="true" stored="true"  />
    <field name="AMOUNT" type="int" indexed="true" stored="true" multiValued="true" />
    <field name="CREDITDOCUMENTNUMBER" type="string" indexed="true" stored="true" multiValued="true" />
    <field name="DEBITDOCUMENTNUMBER" type="string" indexed="true" stored="true"   />
    <field name="SERVICE_TYPE" type="string" indexed="true" stored="true" multiValued="true" />

请帮忙

1 个答案:

答案 0 :(得分:0)

回复信用帖子solr uuid with error document is missing mandatory uniquekey field id

将solrconfig.xml更新为

<requestHandler name="/dataimport" class="solr.DataImportHandler">
    <lst name="defaults">
      <str name="config">data-config.xml</str>
      <str name="update.chain">uuid</str>
    </lst>
 </requestHandler>

<updateRequestProcessorChain name="uuid">
      <processor class="solr.UUIDUpdateProcessorFactory">
          <str name="fieldName">id</str>
      </processor>
      <processor class="solr.RunUpdateProcessorFactory"/>
</updateRequestProcessorChain>