I’m using autocomplete in my application, and it is visible on all pages. Given that it is visible on all pages, how do I make it so that the user is redirected to “/search” on submit or click? As it is now it is not redirected, only the query changes.
Hi @tomas.jansson – If you are using InstantSearch for the search experience on “/search” you can tie the two together using routing as documented here: Integrate Autocomplete with InstantSearch.js | Autocomplete | Algolia
For other search experiences, the pattern is. most likely the same, you’ll need to wrap your search results in href links with URLs that include any routing information you need to render your search page. Remember you’ll also need
getItemUrl if you plan to support keyboard navigation.
I have tied them both together, my problem is how do I get the autocomplete to work on all pages in the best possible way. If I am on a product page and clicking a suggestion I want to redirect to the search page, is there a way to set the root url for suggestions? For direct search hits I can just link to the actual page in question, but for search suggestions I want to go to /search.