How to simulate / apply a facet

Hi All!

First of all, love Algolia - so snappy and smart.

Down to business:

I am trying to apply a facet based off a URL query parameter. For example we could have the URL as, my expected reaction would be it would tick the Insight option within the type facet.

I’ve tried various options but nothing seems to be working, I have used the query parameter to find the relevant checkbox (<input type="checkbox" class="ais-RefinementList-checkbox" value="Insight">) and made it checked manually with JavaScript - But looking at it, seems that a custom event is on the div which actually triggers the search with a filter.

Scoured the docs but couldn’t find out how to actually automatically trigger a Facet.

Anyone got any ideas? Happy to provide code if that helps.


Hi Jamie,

I assume you are using some flavor of our InstantSearch library.
If I understand correctly, you want to provide a default value for a facet filter depending on the url you’re currently visiting.

To do that, you can use the configure widget and pass it filters parameter.
In the context of your example, with instantsearch.js, it would look like:

  filters: 'type:Insight'

You can find more detailed information in our documentation:

I hope this helps,