Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Scotch.io:
Achieving Geo-search with Laravel Scout and Algolia
Jul 19, 2017 @ 14:38:24

The Scotch.io site has posted a tutorial from author Julien Bourdeau showing you how to combine Laravel Scout, a tool that enables full-text searching on Eloquent models and the Algolia searching service to create a geo-search to locate items in your data based on physical location.

Laravel Scout makes it very easy to setup an external search engine to create consumer-grade search quickly. The package comes with Algolia as a default search engine. I'd like to demonstrate how to make use of the geo-location search feature with Scout.

In this tutorial, you'll learn how to prepare your data for Algolia and Laravel Scout to retrieve items based on location.

We recommend you use front-end search for your app because this implementation model is most efficient. That being said, there are cases where you need backend search, for instance, if you want to generate reports.

The tutorial is then broken up into several steps towards the goal of creating the application:

  • Install Scout
  • Format your data for indexing
  • Search for your records
  • Leveraging Macros

The searching they create allows for location of data either by searching in a given location (coordinates and radius) or locating items inside of a "zone" (a rectangle defined by at least two points). All code is included as well as examples of the data structure Algolia requires for your data input.

tagged: geosearch search geography tutorial laravel laravelscout algolia geolocation

Link: https://scotch.io/tutorials/achieving-geo-search-with-laravel-scout-and-algolia


Trending Topics: