0

I need to create multiple unique key in solr collection, and readed related question Solr Composite Unique key from existing fields in schema . But i need this key to be human-readable, now i see hash. I added to:

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 - inside <schema> tag:

<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" />

When i try to add record, for example:

{
    "inn": 764575576,
    "kpp": 123,
    "source": "self"
}

I see a hash "6dab8c2b-e5e3-4d5a-a17a-759da05a3e64" in "id" field. Help me please, how to see "764575576-self-123" instead?

Community
  • 1
  • 1
Alexander Goncharov
  • 1,572
  • 17
  • 20

1 Answers1

1

I've found my error. updateRequestProcessorChain and requestHandler tags must be in solrconfig.xml both! Not in schema.xml

Alexander Goncharov
  • 1,572
  • 17
  • 20