我需要在solr集合中创建多个唯一键,并重写相关问题Solr Composite Unique key from existing fields in schema。但我需要这个键是人类可读的,现在我看到哈希。我补充说:
solrconfig.xml
:
<config>
<!-- Here is standart config -->
...
<!-- My updateRequestProcessorChain -->
<updateRequestProcessorChain name="inn-unique-key">
<processor class="solr.CloneFieldUpdateProcessorFactory">
<str name="source">inn</str>
<str name="source">source</str>
<str name="source">kpp</str>
<str name="dest">id</str>
</processor>
<processor class="solr.ConcatFieldUpdateProcessorFactory">
<str name="fieldName">id</str>
<str name="delimiter">-</str>
</processor>
<processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
</config>
schema.xml
- 在<schema>
标记内:
<requestHandler name="/update" class="solr.UpdateRequestHandler">
<lst name="defaults">
<str name="update.chain">inn-unique-key</str>
</lst>
</requestHandler>
<field name="inn" type="long" required="true" indexed="true" stored="true" />
<field name="kpp" type="long" default="0" required="false" indexed="true" stored="true" />
<field name="source" type="string" indexed="true" stored="true" required="true" />
当我尝试添加记录时,例如:
{
"inn": 764575576,
"kpp": 123,
"source": "self"
}
我在“id”字段中看到一个哈希“6dab8c2b-e5e3-4d5a-a17a-759da05a3e64”。请帮帮我,怎么看“764575576-self-123”呢?
答案 0 :(得分:0)
我发现了我的错误。 updateRequestProcessorChain
和requestHandler
标记必须位于solrconfig.xml中!不在schema.xml中