Multi-Select Facets in Fusion

This article is dedicated to address the task of configuring Fusion Query Results of having multiple-select (checkbox) Facets in Fusion.

To configure the same on Lucidworks View, please refer: How can I enable multi-select facets?

There is a very popular use-case of having the faceted values as multi-select options (checkbox) when we query in our desired collection in Fusion. Generally when we facet, we can select either of the faceted values of a particular facet-field.

Sample Solr index for our test-cases is as below:

{"id":"2","category_s":"Mathematics","genre_s":"Technical","title":["Set Theory"]}
{"id":"3","category_s":"Mathematics","genre_s":"Philosophy","title":["Beauty of Numbers"]}
{"id":"4","category_s":"English","genre_s":"Philosophy","title":["Think and Grow Rich"]}

We facet the Solr results on "category_s" and "genre_s" like below:

If we click on one of the facet values ('English' in this case), the result-set is filtered on that particular facet value:

To enable multi-select facet in Fusion/Solr, we explore tagging and excluding filters. When the multi-select "category" facet is computed, we ignore constraints (filters) on that particular facet so as to get back the correct counts for other "category" facet values. To accomplish the before stated, we tag filters and then selectively exclude filters (i.e. pretend they don’t exist) by tag when faceting.

We explore exclusion filter in this example, not tag. Facet field name is replaced from "category_s" to "{!ex=thequery}category_s". PFB the screenshot for the same.

We can select either of "category_s" facet values ('Mathematics','English') and get the desired filtered results, but the count on facet values remains constant.

Now replace facet field name is replaced from "genre_s" to "{!ex=thequery}genre_s" and we get the following results.

We can select multiple facet values across the categories and filter the result-set without affecting the facet value count.

As we didn't tag our request with the exclusion filter value (in this case 'thequery') for the facet, the facet count for the result-set produced is calculated on the documents which has matched the search criteria (in this case 'Technical').

Now when we introduce Tag filter in the current scenario. Once we exclude the filters for the facets we have tagged in our query, we receive facet counts for the entire solr index, irrespective of the search criteria.
q : {!tag=thequery}Technical

As we can witness, in-spite of providing a specific keyword in the query, and getting limited result-set based on the search criteria, the facet count values are constant throughout.

Now we replace the second facet field name from '{!ex=thequery}genre_s' to '{!ex=otherquery}genre_s' and keeping everything else constant.
facet field 1: {!ex=thequery}category_s
q : {!tag=thequery}English

The facet count values are calculated on whole index for "category_s" whom we have excluded from our filters by tagging ('thequery' in this case) while facet count values for "genre_s" is calculated on the documents we have received after the search criteria.

Henceforth depending on the use-case you are trying to implement through Facets, include and exclude filters on the facets by tagging them and get desired results.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk