Instantsearch.js: aroundRadius and aroundLatLngViaIP handled as string in urlSync

Created on 9 Jun 2016  路  8Comments  路  Source: algolia/instantsearch.js

Hi,
I've custom widget in which I filter results by their location like so:

helper.setQueryParameter('aroundLatLngViaIP', true);
helper.setQueryParameter('aroundRadius', somevalue);

Search is working well and I can see these values send in HTTP requests to algolia.

Is there any particular reason to not have these values in URL when urlSync to enabled? Or is it just a bug?

Core Bug

Most helpful comment

Hi @swistak35 this is not a bug per se but a lack in our documentation on how to track them.

Here's how to do it:

var search = instantsearch({
  // ... other parameters
  urlSync: {
    trackedParameters: [
      'attribute:*', 'query', 'page', 'hitsPerPage',
      'aroundLatLngViaIP', 'aroundRadius'
    ]
  }
});

You could add more of them if needed. Seems right?

Thanks

All 8 comments

Hi @swistak35 this is not a bug per se but a lack in our documentation on how to track them.

Here's how to do it:

var search = instantsearch({
  // ... other parameters
  urlSync: {
    trackedParameters: [
      'attribute:*', 'query', 'page', 'hitsPerPage',
      'aroundLatLngViaIP', 'aroundRadius'
    ]
  }
});

You could add more of them if needed. Seems right?

Thanks

@vvo I assumed that by default everything is tracked in urlSync and that was the thing which confused me. Thanks for your help :)

Awesome, yes indeed we only track SOME parameters by default, this will be documented soon: https://github.com/algolia/instantsearch.js/issues/1089

Hey guys, I am trying to use this for insideBoundingBox and when using the generated URL Algolia throws an error

image

Any Ideas?

That鈥檚 probably because the URL parses this as a string, not a number. Let鈥檚 reopen this if you have more information on how you鈥檙e calling InstantSearch and which url you did

This is how I got it going.

 search = new instantsearch({
    // ... other parameters
    urlSync: {
      trackedParameters: [
        'attribute:*', 'query', 'page', 'hitsPerPage',
        'insideBoundingBox'
      ]
    }
  });

Url: http://localhost:3001/testSite?q=&iBB%5B0%5D%5B0%5D=34.201180305461925&iBB%5B0%5D%5B1%5D=-83.73317161926728&iBB%5B0%5D%5B2%5D=33.29681049453807&iBB%5B0%5D%5B3%5D=-85.04279318073272&p=0&is_v=1

I'm making a new issue for this problem @gtovar333

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devwax picture devwax  路  3Comments

bobylito picture bobylito  路  3Comments

anthonyBertrant picture anthonyBertrant  路  3Comments

proudlygeek picture proudlygeek  路  4Comments

vvo picture vvo  路  4Comments