"Geo-only" search

Hi there!

I want to build a search in a very specific way that I can’t seem to wrap my head around, right now. First, I want to confirm that I have indeed an index and a “more regular” keyword based search up and running in my current project (using vue-instantsearch and the provided vue components).

Now, the thing I don’t know how to do is: I want to additionally build a kind of “geo-only” search experience. Every record in my index has a location associated to it via the _geoloc attribute. The search in my app should now display the n closest entries in the index (to a given location), without any other restriction (no keyword, no facets, etc).

I would be really thankful for a hint on how I can achieve this.

Hi @jdpowered :wave:

How are you planning to input the location? If it’s something you plan to add from your front-end (e.g. user location from the browser) you can think to filter your result around a certain latitude and longitude in the following way (notice the empty query):

var client = algoliasearch('T2ZX9HO66V', 'YourAPIKey');
var index = client.initIndex('your_index_name');

var results = index.search('', {
   aroundLatLng: '40.71, -74.01'
});

https://www.algolia.com/doc/tutorials/geo-search/filter-results-around-a-location/?language=javascript#initialise-the-client

Let me know if this helps you out!