配置 Solr 以使用 UUID 作为键 [英] Configuring Solr to use UUID as a key

查看:14
本文介绍了配置 Solr 以使用 UUID 作为键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置 Solr 4 以使用 UUID,但到目前为止我没有成功

I am trying to configure Solr 4 to work with UUID and so far I am unsuccessful

通过阅读文档,我看到了两种不同的方式来配置 schema.xml 以使用 UUID(两者都不起作用)

From reading the documentation I have seen two different ways to configure schema.xml to work with UUID (both do not work)

对于两者我都需要写

<fieldType name="uuid" class="solr.UUIDField" indexed="true" />

选项 1:添加:

<field name="id" type="uuid" indexed="true" stored="true" default="NEW" multiValued="false"/>

并确保删除该行

<uniqueKey>id</uniqueKey>

选项 2添加:

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

两个选项都无法正常工作并返回org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: 初始化 QueryElevationComponent 时出错.

Both options are not working correctly and returning org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.

我还尝试使用以下配置向 colrconfig.xml 文件添加一行:

I also tried adding a row to the colrconfig.xml file with the configuration:

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

谢谢,

西蒙

推荐答案

经过一番努力,这里是解决方案:

After some work here is the solution:

在 schema.xml 中,添加(或编辑)字段字段

In schema.xml, add (or edit) the field field

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />   

在 solr 配置中,更新链并将链添加到处理程序中(例如:for/update/extract):

In solr config, update the chain and add the chain to the handlers (Example: for /update/extract):

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

<requestHandler name="/update/extract" 
                startup="lazy"
                class="solr.extraction.ExtractingRequestHandler" >
  <lst name="defaults">
    <str name="lowernames">true</str>
    <str name="uprefix">ignored_</str>
    <str name="captureAttr">true</str>
    <str name="fmap.a">links</str>
    <str name="fmap.div">ignored_</str>
    <str name="update.chain">uuid</str>
  </lst>
</requestHandler>

这篇关于配置 Solr 以使用 UUID 作为键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆