Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting values into Solr boolean fields

I'm trying to insert a value into a boolean field in solr by passing it as a field in a doc, thus:

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

The field definition in schema.xml is:

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

I haven't been able to find any documentation on what value should be used where it says "value-here" in my example. I have tried true & false, True & False, TRUE & FALSE, 1 & 0 all to no avail - there are still no documents in my index with a value in the boolean field. All of my non-boolean fields with stored="true" are getting values.

All suggestions welcomed.

like image 545
Jason Avatar asked May 19 '11 09:05

Jason


1 Answers

The answer is "true" or "false", doesn't appear to be case sensitive. For example:

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

An error elsewhere in my app was putting an empty string in where I was expecting a value.

like image 185
Jason Avatar answered Oct 17 '22 08:10

Jason