Add search parameter when using InstantSearch

In instantsearch, I would like to add a parameter to my query, so for example if my user is at en.website.com I want to only have results where the language is en.

How can i add a restriction like this with the Instantsearch library.

Hey,

Sure, you will need to use the configure widget: algolia.com/doc/api-reference/widgets/configure/js/.

On the search parameters, you will need to provider the filters parameter:

instantsearch.widgets.configure({
  filters: 'language:en'
});

Please don’t forget that you will also need to add the “language” to the list of “attributesForFaceting”: algolia.com/doc/guides/managing-results/refine-results/filtering/how-to/filter-by-string/#configuring-attributesforfaceting.

Let me know how it goes,
Thanks.