Ramesh Yadav
Ramesh Yadav

Reputation: 31

Set solr field values based on other fields

I have three fields in the Solr core:

I am setting a value for Field1 and Field2 in the DIH, but I want to set the value for Field3 based on some values in Field1 and Field2.

For Example, Field1 and Field2 are the boolean types so I want to check if either Field1 or Field2 is true and then set the Field3 value as true otherwise set false.

Upvotes: 1

Views: 48

Answers (1)

Kyrylo Romantsov
Kyrylo Romantsov

Reputation: 182

The easiest way to achieve it is to use a script in your DIH, here is an example:

<document>
  <entity ...>
    <field column="..." name="Field1" />
    <field column="..." name="Field2" />
    
    <field name="Field3" script="Field1 || Field2" />
  </entity>
</document>

Upvotes: 0

Related Questions