apache - Solr 4 - 缺少必填字段 : uuid

标签 apache solr lucene solr4 dih

我在使用 Solr4 中的 dataImportHandler 生成 UUID 时遇到问题。我试图从现有的 MySQL 数据库导入。

我的 schema.xml 包含:

<fields>

    <field name="uuid" type="uuid" indexed="true" stored="true" required="true" />

    <field name="id" type="string" indexed="true" stored="true" required="true"/>
    <field name="address" type="text_general" indexed="true" stored="true"/>
    <field name="city" type="text_general" indexed="true" stored="true" />
    <field name="county" type="string" indexed="true" stored="true" />
    <field name="lat" type="text_general" indexed="true" stored="true" />
    <field name="lng" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
    <field name="price"  type="float" indexed="true" stored="true"/>
    <field name="bedrooms" type="float" indexed="true" stored="true" />
    <field name="image" type="string" indexed="true" stored="true"/>

    <field name="region" type="location_rpt" indexed="true" stored="true" />       

    <defaultSearchField>address</defaultSearchField>

    <field name="_version_" type="long" indexed="true" stored="true"/>
    <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

 </fields>

 <uniqueKey>uuid</uniqueKey>

然后在 <types>
  <fieldType name="uuid" class="solr.UUIDField" indexed="true" />

我的 Solrconfig.xml 包含:
 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">  

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

 <lst name="defaults">
    <str name="config">data-config.xml</str>
 </lst>

每当我运行更新时,都会插入一些文档 ok ,购买许多返回:
org.apache.solr.common.SolrException: [doc=204] missing required field: uuid

最佳答案

link 为例它应该是

<requestHandler name="/dataimport"  class="org.apache.solr.handler.dataimport.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">uuid</str>
  </processor>
  <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>

关于apache - Solr 4 - 缺少必填字段 : uuid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16914324/

相关文章:

windows - 如何找到 Apache 的 httpd.exe 安装位置?

search - Solr 使用 contains 进行搜索,听起来像

join - 用于匹配嵌套/关系数据的 Solr 查询

elasticsearch - ElasticSearch-如何在每个聚合桶中获得最小时间戳?

lucene - 将 Lucene HitCollector (2.x) 迁移到 Collector (3.x)

php - LAMP 服务器是否可以在需要时更改其 IP?

apache - 在 k8s 上安全地运行 apache 容器

python - Django Apache 值错误 : Attempted Relative Import in non-package

java - Apache Solr 通过 SSL 进行分布式搜索

java - 如何让 Lucene 中的 QueryParser 处理数字范围?