Here's a CodeSandBox example of how you can trigger a redirect directly in AutoComplete. A redirect rule was created for this index with a Condition of Query Is algolia
and a Consequence of Return Custom Data. To see how this works in the live environment simply type the query "algolia".
{
"redirect": "https://www.algolia.com/doc/"
}
It looks for the redirect user data using getAlgoliaResults.transformResponse()
and sets its value in the context.During onStateChange()
or onSubmit()
. The difference between the two being that onStateChange()
will trigger the redirect as soon as the user types the last character in the query Condition, while onSubmit() will only trigger the redirect when the user hits enter with the full query condition in the search box.
Comments
0 comments
Article is closed for comments.