What's the best way to show all items of an active facet. In other words: How can i make a facet still show all items (e.g. disabled/greyed) even if one item is selected a active facet item?

CommentFileSizeAuthor
#4 Schermata 02-2455967 alle 22.38.47.png53.06 KBheacu

Comments

cpliakas’s picture

The best way is to implement the negative facet pattern which, can be done be setting the "Minumum facet count" to "0" in the global settings. Note that the backend has to support this, and there is an issue posted against Search API that blocks this functionality. See #1306008: Negative facets not displayed when the mincount is 0 for more info. Apache Solr Search Integration supports the negative facet pattern. Faceted Navigation for Search does not.

Thanks,
Chris

danielnolde’s picture

Thanks for the help, Chris.
The patch in #1306008 in comment 2 did the trick for the search_api backend.
Should we hint the setting of "minimum facet count" to 0 as a description/help text for this field (I could make a patch for this) ?

cpliakas’s picture

If you think that would be helpful to others, then yes! I would definitely support a patch for better descriptions.

heacu’s picture

StatusFileSize
new53.06 KB

A better way is to use "filter exclusion" as documented at http://wiki.apache.org/solr/SimpleFacetParameters in the SOLR wiki ("Tagging and excluding Filters" ). This way you can get the correct counts, i.e. how many documents would there be if you deactivated the selected facet and chose the other facet instead.

I found a nifty solution for a previous project using filter exclusion: do two separate queries on the same facet field. The first facet query gives counts for the documents with a filter applied. The second query gives counts for the same facet field, but with the filter excluded. You then merge the sets, prioritizing counts from the first set. Clicking on one of the facets from the first set will further narrow the query. Clicking on a facet from the second set will unset the initial filter, and then apply the new one. I distinguished the two sets by shading, as evident from the attached snapshot. The darker facets will be added to the query, thus narrowing search. The orangeish facets replace the existing filter.

This system works great because it saves users the annoying step of deselecting a facet.

cpliakas’s picture

This is really cool! Have you run this by the Apache Solr Search Integration guys? If that module would support this option, Facet API coud very easily integrate with it.

Thanks for posting,
Chris

cpliakas’s picture

Status: Active » Fixed

Marking as fixed since multiple solutions have been provided and the feature suggested in #4 should be posted against Apache Solr Search Integration.

danielnolde’s picture

Let's continue the discussion about keeping full (unfiltered) facet item counts for facets with only one item active at http://drupal.org/node/1446824

cpliakas’s picture