1

I have three fields in the Solr core:

  • Field1,
  • Field2,
  • Field3.

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.

Kyrylo Romantsov
  • 172
  • 1
  • 1
  • 11
  • If you're using DIH you're probably fetching information from SQL - in that case, use an SQL statement (`IF ...`) to get a column with the value you want from your RDBMS. – MatsLindh Aug 02 '23 at 10:57

1 Answers1

0

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>
Kyrylo Romantsov
  • 172
  • 1
  • 1
  • 11