Gravatar for andrew.harbert@nttdata.com

Question by adharbert, Nov 6, 2014 11:39 AM

Facet groups disappear when selecting one

I have 5 facets set on a page and each one has a few sub items to search one below them. Everytime I select one item, the other 4 facet groups disappear. Is there a way to make them stay visible, in case I want to select those as well?

1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Nov 7, 2014 3:24 AM

My best guess is that by selecting a value in the first facet you end up excluding the results contain the values for the other facets, and thus they display nothing. Facets always display the values present in the currently matching results.

We do have special code to ensure that the facet you're currently selecting stuff in continues showing up the previous values (in case you want to multiselect, if the facet is using the OR operator). But other facets will immediately update to reflect the changes. And even if they didn't, selecting values there would simply match 0 results, since filters from separate facets are always combined using AND.

Typically in those use case the proper way to do it is to ensure that all documents "providing" values for the "sub" facets also have the proper field values for the first facet, so that they aren't excluded on selection. Ex, if you have a @category and @subcategory field, every document with a @subcategory should also have one or several corresponding @category.

Gravatar for olamothe@coveo.com

Comment by olamothe, Nov 7, 2014 9:27 AM

You could also change the facet operator to OR, if it's really the desired behavior.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Nov 7, 2014 10:27 AM

Not sure this will change anything for the other facets…

Ask a question