Couple of questions about urlSync (instantsearch.js)

We’re using Algolia and instantsearch for BetaList Jobs and loving it. :heart_eyes:

There’s a few questions I have about how urlSync works. Please see our implementation for reference.

  1. We use disjunctiveFacetsRefinements for the type of job commitments (full-time, part-time, etc). How can we sync these in the URL? I would expect adding attribute:* to trackedParameters should cover it, but it doesn’t.

  2. Latitude/longitude (aroundLatLng / aLL) is synced to the URL successfully, but instantsearch doesn’t pick it up when instantiated. Any idea what might be causing this?

  3. I would like to completely redesign the URL design to something like betalist.com/jobs/$commitment-$query-in-$location (e.g. betalist.com/jobs/full-time-frontend-developer-in-amsterdam). Are there any urlSync-related functions I can override for the generating and parsing of URLs? For the generation I’d just need the values of tracked parameters and return a string, and for parsing the reverse.

Any other suggestions you might have with regards to our implementation are of course welcome too.

Thanks in advance! :v:

Hi @marc

Here are some thoughts about your questions :thinking:

  1. You set some searchParameters and those won’t be overridden by the URL. However setting no filter should have the same effect (unless you have other hidden values in your dataset)

  2. The URL sync does read the value but it has no meaning for the widget which can display anything and I guess will reset the parameter altogether. For this one, I don’t have a clue :confused:

  3. That would be a nice API indeed. I created an issue for that purpose https://github.com/algolia/instantsearch.js/issues/2209 (we’ll explore that soon)

Also you should update the URL you use for jsDeliver (they’ve changed the url scheme to fetch packages): [instantsearch.js] 1.11 release 🎉

Cheers :wave:

2 Likes

Following up on this. I noticed that the issue you linked was closed and referenced the connectors API for use with custom urls.

I haven’t exactly worked out how to achieve what @marc was trying to accomplish here: