Insert Values ​​into Solr Boolean Fields

I am trying to insert a value into a boolean field in solr, passing it as a field in the document, this way:

<add> <doc> <field name="WouldBuySameModelAgain">value-here</field> </doc> </add> 

Field definition in schema.xml:

 <field name="WouldBuySameModelAgain" type="boolean" index="false" stored="true" required="false" /> 

I could not find the documentation about what value should be used where in my example it says "value-here". I tried true and false, True and False, TRUE and FALSE, 1 and 0 all to no avail - in my index there are still no documents with a value in the boolean field. All my non-boolean fields with the saved value = "true" get the values.

All suggestions are welcome.

+6
source share
1 answer

The answer "true" or "false" does not appear to be case sensitive. For instance:

 <field name="WouldBuySameModelAgain">true</field> 

Elsewhere in my application, an empty string was placed where I was expecting a value.

+7
source

Source: https://habr.com/ru/post/888512/


All Articles