Rank results by location

Hey,

I am looking to rank the results I get back from Algolia by location but I am having trouble finding how I would pass the current location of the user to Algolia. I am using react native instant search. I do not need to search by the location but rather rank the results returned by the location given.

I have tried looking into passing the searchParamters but have not been able to pass it into the REACT NATIVE Instant search component.

My records have a _geoloc data point.

Thanks

I was able to fix the issue using the Configure widget like so

import { InstantSearch, Configure } from 'react-instantsearch-native';

<InstantSearch>
      <Configure aroundLatLng="43.6532,79.3832"/>
</InstantSearch>

Thanks

Hi linepass
Thank you for your feedback.
Indeed that information must have been a little hard to find. I’m glad you ended up finding it.

@samuel.vaillant where do you think we can document this? Is it a common enough pattern that we can right a guide about it?

Right now user that want to build a Geosearch need to combine information from widgets API reference and the API docs.

Hi @linepass,

Indeed inside our guide about geo search we don’t mention the usage of the Configure widget but we should. Thanks for the suggestion!

You can find two examples of a geo search application inside the React InstantSearch project. The first example uses the Configure widget and the second one uses the createConnector API. The advantage of the connector is that you have the full control of the refinement process. You can find more information about the API in the documentation.

@samuel.vaillant & @Youcef how would someone use this feature in React with InstantSearch, ConnectedSearchBox & ConnectedHits?. Best, Ash

Hi @peruse.web, I’m not sure to fully understand the question. Could you provide a bit more context? Maybe an example? That would help to better understand the problem. Here is a template for React InstantSearch.

Thanks!