Show facets without hits


I’m new to Algolia so bear with me.
I’m using algoliasearch without InstantSearch.
Whenever I’m filtering on facets (e.g. brands) all the other facet options disappear (are not returned with my…) method).

How can I make it so that the facets without hits are still visible?

@axel.hamelryck welcome to the community!

The issue here is that technically the other facets don’t have any Hits, so we don’t include them since they would be not really useful in most cases.

I looked into how our libraries achieve this (since InstantSearch handles this extremely well), and it looks like we submit two queries. One has the search request in it and the other is blank and returns all of the facet values available. You can submit multiple queries at once to the API using client.multipleQueries() - more information can be found here.

Happy to help further, let us know! Thanks!

Hello and thank you!

I think I understand but I’m having some troubles. In the UI demo from my Algolia dashboard the facets are ‘dynamic’ to eachother, e.g. when selecting one filter the facet counts of the other facets will adjust accordingly and I’m having some problems trying to achieve that. I’m going to put some screenshots to be sure:
Without any filters selected

With filters; as you can see the size facet counts have been adjusted and this would be the exact behavior I’m looking for

Thank you in advance!

Hey there, I had a similar problem and posted a solution here How to narrow down facets based on selected options? - #5 by dspooner