Maybe I missed something in the documentation, but I'm using Apache Solr with Facet API, and want to be able to filter negatively by items that do NOT have a term, and can't seem to do what I'm after...

For example, I have a Facet API block connected to my taxonomy for color:
- red
- blue
- yellow
- orange

Wand I want to be able to filter by items that are NOT red, or NOT blue (in addition to being able to filter by items that ARE red, or ARE blue).

Can someone point me in the direction of how to most easily achieve this kind of functionality? Is a custom widget needed? Surely people have attempted this kind of negative filtering?

Thanks for any help!

Comments

JordanMagnuson’s picture

Ideally, I would like the negative facets to show up immediately below each positive facet.

So instead of a list of facets like this:
- red
- blue
- yellow
- orange

I would have a list like this:
- red
- NOT red
- blue
- NOT blue
- yellow
- NOT yellow

This would work decently as a select list, and work really well with something like Facetapi Multiselect, because the user could type in "red" and see the options for "red" and "NOT red" right there, both very obvious in function.

JordanMagnuson’s picture

Any thoughts/help on this?

JordanMagnuson’s picture

Still trying to figure out how to implement this, if anyone has any guidance... Thanks!

JordanMagnuson’s picture

Found an old Stack Overflow answer with some info on creating a negative boolean filter for Lucene, but not sure how to apply this using Facet API / Apache Solr: http://stackoverflow.com/a/4489081/299337