Instant search RefinementList

I am using instantsearch.js in my search and noticed the refinementListCount is counting through my entire index. How can I be able to restrict it to count on in the category field?. My site is a blog based on Jekyll, so each blog has a category that may consist of an array with almost 3 categories.

I would recommend you add a filter with the category you’re currently in to make sure the query is only searching this subset of your content. The refinementListCount will be automatically impacted and only show the counts within this category as the underlying faceting counts are computed from the results set.

To add a filter to an instantsearch implementation, you can use the “Configure” widget: https://www.algolia.com/doc/api-reference/widgets/configure/js/

1 Like

@sylvain.utard Please help, how to achieve this. How is it possible to make a filter that tells it not to search anything in a certain attribute.

filters:'NOT content.anything'

Not sure I understand the need here, are we still trying to restrict the faceting counts to a subset of the index or is it another issue “not using a specific attribute for the search”? If it’s the latter, I would recommend reading how to configure custom index settings from the Jekyll indexer and read about our searchable attributes.

Good luck!