Location Search with Miles Radius Filter

Hi,

I’m using Laravel and InstantSearch JS (previously Vue InstantSearch).

I’m currently collecting a non-specific location from users e.g. Brighton, Nottingham, etc.

A place, not an address.

I want users using the search to find profiles by location (which they can currently do) however I want searching users to increase the radius of the location search e.g. within 5 miles, within 15 miles and so forth.

So if a user searches Nottingham and one of the profiles has entered a location within 5 miles of Nottingham and the search user selects the “within 5 miles” option in a purposed second filter that profile should appear in the search (like the Right Move example below).

I hope this makes sense and thank you in advance for any help.

Alex

What system do you already have in place?

It would be helpful to reproduce what you have in this sandbox.

I’m currently working on rebuilding this interface/search but this was the last launched search page.

https://esbc-beta.dsd-net.com/catalogue

As you can see on this page you can use the search bar to search profiles by location.

I still want to do that but I want to increase the radius for the location to show the profiles that fit in the radius from the original location entered (I hope that makes sense).

I can’t recreate this on CodePen.

Hi @alex8,

I believe this documentation may help.

If that doesn’t help can you provide a sample record that you are using in Algolia and a code snippet of the search query?

Hi @cindy.cullen,

Thanks for the reply this looks great.

Any advice on how I could implement this using InstantSearch JS?

Hi @alex8,

aroundRadius and aroundLatLng are search parameters so you can set them in InstantSearch using the configure widget.

Happy searching!

Hi @marie.gillier,

Thanks for the reply.

I’ll give this a try and see if I can get it to work how I’d like.

I’d imagine the best way would be to set up an input that uses Algolia Places for users to search / enter a location.

Then use the lat & long that “Places” returns from that location for the search radius.

Hi @alex8,

Yes, this is an option, but if you do not want for your users to input their location manually through an input, you can also use aroundLatLngViaIP instead of aroundLatLng: https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/