#community-help

Embedding Search Query and Filters in URL with instantsearch.js

TLDR John inquired about embedding search query and filters into URLs with instantsearch.js. Jason responded with an affirmative, provided a solution and documentation link.

Powered by Struct AI

3

4
30mo
Solved
Join the chat
Jun 03, 2021 (30 months ago)
John
Photo of md5-7a0ab48aa8979a59e1d8c3919797c1f8
John
12:12 AM
Hi, I'd like to know whether it is possible with instantsearch.js to have the search query and the filters be part of the URL, like on this site: https://www.fashionmasks.org/mascara?fm-filter=[ctg=13;age=5;gen=26;siz=unc;prc=0-50;prc=150-199] - here the query was mascara and the filters are the part of the URL after the question mark. It would be so awesome to be able to save a search!
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:16 AM
Yup! You just need to set routing: true when initializing instanstearch like this: https://github.com/typesense/showcase-recipe-search/blob/7a9396a76fbfc4b749531fc34546fa92ba654b10/src/app.js#L140

1

John
Photo of md5-7a0ab48aa8979a59e1d8c3919797c1f8
John
01:05 AM
OK very nice!!! Thank you!👏

1