Skip to content

How to perform a “silent” fallback search in React InstantSearch without losing facet sync or overwriting the user’s query #6546

Answered by Haroenv
1127461-Mike asked this question in Q&A
Discussion options

You must be logged in to vote

Your understanding of the nesting and inheritance is correct indeed.

That does clarify it, however I'm not sure on how to achieve this. If you'd apply those different parameters, there would be a new search, which then would change the child results again, which seems like it has some looping potential.

I wonder if a more correct approach is to do this logic entirely in the search client level:

  1. do a search
  2. if no results, do another search
  3. return the results of this search

Normally then all facet values should be available as the ones from the final search that happened, and the UI should behave as expected.

the code would look something along the lines of:

const client = algoliasearch();

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@1127461-Mike
Comment options

@Haroenv
Comment options

@1127461-Mike
Comment options

@Haroenv
Comment options

Answer selected by 1127461-Mike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Library: React InstantSearch ≥ 7 Issues in any of the react-instantsearch@7 packages (formerly named react-instantsearch-hooks)
3 participants