> : query that in fact returns the "negative" results. As a simple example, > : I believe that, for a boolean field, -field:true is exactly the same as > : +field:false, but the former is a negative query and the latter is a > > that's not strictly true in all cases... > > * if the field is multivalued=true, a doc may contain both "false" and > "true" in "field", in which case it would match +field:false but it > would not match -field:true > > * if the field is not multivalued-false, and required=false, a doc > may not contain any value, in which case it would match -field:true but > it would not match +field:false
You're totally right. But it was just an example. I just didn't think about specifying the field to be single valued and required. I did some testing yesterday about how are filteres cached, using the admin interface. I noticed that if I perform a facet.query on a boolean field testing it to be true or false it always looks to add two entries to the query cache. May be it also adds an entry to test for unexsistence of the value? And if I perform a facet.field on the same boolean field, three new entries are inserted into the filter cache. May be one for true, one for false and one for unexsistence? I really don't know what it's exactly doing, but doesn't look, at first sight, like a very optimal behaviour... I'm testing on 1.4.1 lucidworks version of solr, using the boolean field inStock of its example schema, with its example data.
