typesense / typesense-instantsearch-adapter

A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
MIT License
403 stars 63 forks source link

sortBy and IS routing #23

Closed victorbosh closed 3 years ago

victorbosh commented 3 years ago

What is the best way to use sortBy and instantsearch.js routing? What I'm trying is to have urls like &sort_by=price:desc filtering results and preselect sortBy widget option

jasonbosco commented 3 years ago

You’d just have to set routing: true when initializing instantsearch like this: https://github.com/typesense/showcase-songs-search/blob/39b3a402da0d0df4cda458daeb3909e030e3ba58/src/app.js#L158

More details here.

victorbosh commented 3 years ago

I'm using https://www.algolia.com/doc/guides/building-search-ui/going-further/routing-urls/js/#seo-friendly-urls so it is not that simple :) There is createURL, parseURL, stateToRoute and routeToState works fine, but tricky with sortBy widget

jasonbosco commented 3 years ago

Ah yes, SEO-friendly URLs were a little not-so-straightforward to setup with InstantSearch.js, so I haven't ventured into it yet. Let me know if anything in their docs work with Algolia but not Typesense. That would indicate an issue with this adapter and I can take a closer look.