How aply a filter without usser interaction on angular instasearch

i want to aplicate a filter for category to my results before show this to users.
i have a list of the categories of the products in the page. I want make click in one of this categories and go to the page of results with the filter applied

in the picture I show what i want to do

you can use a configure widget with hierarchicalFacetsRefinements set to the value you expect. You can log out what value you have when you select something by logging search.helper.state

Hi! thank you for your reply.
I can’t find the hierarchicalFacetsRefinements option in angular instasearch documentation

Hi Gianni, the option is one of the helper, for which we unfortunately don’t have a clear api ref (best is this: Here’s an example on how to use the hierarchical refinement in angular:

  hierarchicalFacetsRefinements: {
    'hierarchicalCategories.lvl0': ['Audio > Auxiliary Input Cables']

Thank you very much.
This has been very useful but it gives me error when I try to instantiate ‘searchparameters’ from typescrip

here is the data in my index


my code is the following


on ngOninit function:


I get the following error:
ProductsListComponent.html:6 ERROR TypeError: Cannot read property 'separator' of undefined

thank you again

Hmm, maybe in that case you should add hierarchicalFacets: [{ name: “nameofyourfirstfacet”, separator: “ > ”, attributes: [...your facets] too

hi again! where I can find all the searchParameters? because I want filter by a facet value but not hierarchical. How I can do it?

thank you!!

Hey, unfortunately there’s no clear API ref for that, but you can find all the accepted parameters here:

1 Like

you are the best!! thank you!

1 Like