restrictSearchableAttributes on React Instantsearch

I found this this topic where the users asks about how to set searchable attributes for a specific search. The response goes on to say that can only be done via the backend and not for a specific search.

Hello @thomasjosephbush,

searchableAttributes parameter needs to be set via setSettings method in your backend. It’s scope is only settings and therefore it cannot be set as query parameter when you search.

The instantsearch.js code you pasted in you message is intended to only perform search operations and no indexing operations. And you can only restrict searchable attribute there - that one is correct.

So in order to make it work, you need to move the setting of searchableAttributes to your backend where you index your data and create your indices.

In the documentation I found a restrictSearchableText attribute that does appear to be able to be set for a specific search however I can’t find any info about how to set this in the (react) instantsearch widget.

I also found this reference that indicates that it can be done for the Angular version, so I assume it can also be done for the react version.

Thanks!

Hi @gabe1, restrictSearchableAttributes is a search parameter. You an use it in the configure widget for react.