I'm working on a product filter for our website and have run into some difficulties regards to using "facet.missing = true".
I know that I'm supposed to use a query filter like "fq=-facetField:[* TO *]" to filter the results to products with that field missing.
I have built a global filter helper for my application that builds the fq parameter dynamically for ALL queries to prevent any from missing out on user permission based filters which essentially looks like this (php):
$params['fq'] = sprintf('((%s) AND (%s))', $custom, $system);
Where $system is the global permission based filter, which might look like (not actual but similar):
(isdiscontinued:0 AND ishidden:0 AND contract:3)
$custom contains the actual filter query the user is building via the UI. Let's say the notebook bluetooth filter has the name fq_bluetooth with values: No, Yes, or the value is missing. This would make the final fq look like:
((-fq_bluetooth:[* TO *]) AND ((isdiscontinued:0 AND ishidden:0 AND contract:3)))
However this returns 0 products for the query I'm sending for this category.
If I modify the filter query to:
((fq_bluetooth:[* TO *]) AND ((isdiscontinued:0 AND ishidden:0 AND contract:3)))
Then I get the result could expected of the counts of Yes + No, disregarding the unspecified.
How should I be formatting the filter query to get this to work properly?
[edit]
I might also want to combine the facets and maybe filter on only products with No bluetooth or ones where bluetooth isn't specified. So maybe like this (which of course doesn't work either):
((-fq_bluetooth:[* TO *] OR fq_bluetooth:"No") AND ((isdiscontinued:0 AND ishidden:0 AND contract:3)))
I'm noticing with debugQuery on, I'm seeing a filter query like:
fq_bluetooth:("No" OR -[* TO *])
being parsed as:
fq_bluetooth:No -fq_bluetooth:[* TO *]
I'm not seeing the OR in the parsed query - and from my research the fq parameter queries don't honor the OR operator(??).
Maybe the OR is working, but as the negative query seems to be failing by itself, perhaps that's why I can't see the OR working when combined like this.