Categories filtering

Hi, I’m new to Algolia and I’m having trouble filtering hits according to categories. For example, I want to be possible to only search for products in the “Addons” subcategory. I left the filter code commented out. Sandbox: friendly-brook-qtpbkk - CodeSandbox

Thank you guys

Hi @felipee.noia

I’m playing with your code and I’m not sure where you’re having trouble? I was able to uncomment the code and change the value of the filter and see different results (for instance filters: 'taxonomies.download_category: Elétrica'). I was able to further refine these results by adding a query string within the search and I see only results within that category.

Are you trying to inject the filter into the InstantSearch search UI? If so, you can either inject it using a configure widget (if you don’t want the end user to change it) or using an initialUiState in your instantsearch object (if you just want to pre-set the refinements and let the user change them later).

Here’s a codesandbox with some examples of setting filters using the configure widget:

This is what I was trying to do! Thank you very much for the help and quick response.

1 Like