React-instantsearch: Search State Parameter

Created on 10 May 2017  路  5Comments  路  Source: algolia/react-instantsearch

Question

I have a React+Redux application where I reproduce search state from a query URL. It seems passing this search state to the InstantSearch component is not sufficient enough to reproduce the search. Do I need to use virtual widgets to reproduce the refinements? If so this seems a bit clunky as I'll have to have many virtual widgets each reproducing refinements. Also if this is the case you may want to update the documentation on Search State to explicitly state widgets/virtual widgets must be present for the refinements.

Guide

Most helpful comment

@Haroenv Actually if the refinement is something covered by a widget, it's easier to use it directly.
For the rest of the search parameters that are not covered, then <Configure/> should be used.

All 5 comments

Hi @flouc001

You're right, the search state himself it's not sufficient for Instant Search to make the correct request. For that you need the corresponding widget to be mounted (either regular or virtual if you don't want any rendering). That's because each widget contains the search business logic, including what search parameters to set.

We should definitely make our guide clearer about that if that's not mentioned anywhere.

Thanks for reporting this.

You could also use Configure to set refinements manually, that should send a request automatically.

@Haroenv Actually if the refinement is something covered by a widget, it's easier to use it directly.
For the rest of the search parameters that are not covered, then <Configure/> should be used.

Thank you for your suggestions!

This issue seems to have been solved,

The search state format is explained here: https://www.algolia.com/doc/guides/building-search-ui/widgets/customize-an-existing-widget/react/#the-search-state-format-explained

Was this page helpful?
0 / 5 - 0 ratings