How to add single values ​​to a multi-valued field in solr

I have a multi-valued field called a category (which is also a storage field) in which I need to add only different values

<field name="category">value1</field>
<field name="category">value2</field>

If I do the update as follows
<add>
<doc>
<field name="id">E02</field>
<field name="category" update="add">value2</field>
</doc>
</add>

I get the value 2 twice twice
<field name="category">value1</field>
<field name="category">value2</field>
<field name="category">value2</field>

I need to store / update only scattered values ​​in category fields, which are multi-valued fields. How to make it solr?

Thanks in advance, Jagadesh.

+4
source share
1 answer

You can β€œinstall” instead of β€œadd” to recreate the saved field in partial document updates. Therefore, if this is the case, when you have all the field values, just paste them into Set and then re-fill the field. You have all the data to recreate it due to the stored field requirement.

+1
source

All Articles