From schema.xml:
<field name="myfield" type="integer" indexed="true" stored="false"/>
The record with id 5 has myfield with value of 0, which I’ve confirmed by searching for plain id:5 and looking at the objectXml.
A search for id:5 AND myfield:0 returns no records.
A search for id:5 AND -myfield:1, however, returns the record I am expecting.
Why?
—
Additional info:
Definition for integer type:
<fieldType name="integer" class="solr.IntField" omitNorms="true"/>
Solr version: 1.4
I’ve solved the issue. It was a bug in the core of the application (third party CMS) and had nothing to do with Solr.
The problem was that the vendor’s code was verifying to see if the value being indexed was not false before indexing it. Unfortunately, they were doing so like this:
Of course, 0 evaluates to false, even if it’s the string “0”.
I changed it to:
… and now it works.
Thank you for your efforts and sorry the problem ended up being something completely unrelated.