Limit InstantSearch results to a subset of data based on user information

I am building an app with react-dom, and started integrating with Instantsearch recently.
The user can search blogposts based on their titles. However, the posts belong to specific groups, and only members of a specific group should be able to see the post in the search results.
Inside the post object is a “whitelist” range field, where the allowed groupIDs are.
Inside the user’s profile is a “groups” range field where all the groups he belongs to are listed.

Is it possible to use the Config widget + the “filters” parameter to check if there is a common value in both ranges?
I can pass the list from the user’s profile as a props to the Algolia component, but I can’t really seem to use it.

Thanks a lot for your help!


Yes you should be able to define unselectable pre configured filters using the [Configure widget] ( You can also use default refinements and virtual widgets to do that.

If you weren’t able to make it work using the links above, can you send us a sample of your code that didn’t work on CodeSanbox ?

thanks for your answer, and sorry for the delay.
From what I can see, the issue with default refinement is that it does not seem to support AND & OR to create what would be a list of defaultRefinement(s).
I think I solved it by using Configure + filters: a plain function iterates through the users’s groups and returns the correct syntax to fit the filters parameter.
Would there be an issue with this solution?
Thanks a lot


This is the correct way to do it :slight_smile:
Don’t hesitate to contact us if you have any more questions!