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

SitePoint PHP Blog:
How to Build a Lyrics Website with Laravel Scout and Algolia
Jul 06, 2017 @ 17:06:11

On the SitePoint PHP blog they've posted a new tutorial showing you how to create a lyrics website with the combination of Laravel Scout and the Algolia data search service.

In this tutorial, we will create a minimal lyrics web site using Laravel Scout and Algolia. To do so, we need a CRUD app to work with our data, and a search interface to let users search through the content. However, instead of creating the full app from scratch, let’s just install the finished CRUD app that we’ve created for this tutorial.

Algolia is a hosted search engine API, providing us with all the tools and resources we’ll ever need to create products with awesome search capabilities.

The end result is a site with a simple search box that displays the matching album/songs for the search string provided. They start in on the code by bootstrapping the project and setting up the database (including loading it with the included SQL file). Next they install the Laravel Scout package and update the "Song" model to be searchable. The tutorial then walks you through the creation of a Algolia account, indexing the current data and importing it into Algolia. Finally it circles back around to the site and helps you create the pieces (controller/view/etc) to make the frontend search work with the Algolia API for searching the indexed data.

tagged: tutorial algolia search laravel scout lyrics integration api

Link: https://www.sitepoint.com/build-lyrics-website-laravel-scout-algolia/

Matt Stauffer:
Introducing Laravel Scout
Aug 03, 2016 @ 16:18:23

In his contuning series looking at the features coming in the next release of the Laravel framework (v5.3) Matt Stauffer takes a closer look at Laravel Scout, a new package that makes integration of content searching simpler for Laravel applications.

Search tools ElasticSearch and Algolia have gained a lot of popularity in the Laravel community in the last few years as powerful tools for indexing and searching your data.

[...] If you take a look at my pull request or theirs [to add Algolia support for Laravel], you'll see that it's not a small task to integrate fulltext search into your site. Algolia has since released a free product called Algolia DocSearch that makes it easy to add an Algolia search widget to documentation pages. But for anything else, you're still stuck writing the integration yourself—that is, until now.

He then goes about introducing what Laravel Scout is and how it integrates directly with Eloquent to make it easier to search and index their contents. It's a separate package that needs to be pulled in via Composer, but then it's simple to integrate. He includes examples of querying the data, setting the queries to queue and a few special cases to watch out for in your own Scout use.

tagged: laravel scout searching algolia fulltext package eloquent model

Link: https://mattstauffer.co/blog/introducing-laravel-scout

Symfony Blog:
The New Symfony Documentation Search Engine
Apr 29, 2016 @ 15:49:27

In an effort to improve their "developer experience" (DX) around using the Symfony framework the development team has introduced new searching functionality to help more effectively find what you're looking for in the expansive Symfony documentation.

Symfony boasts one of the largest documentation pools ever written for an Open- Source project. Considering the ten different Symfony versions (from 2.0 to master) and including the code samples, Symfony Documentation has around 3.6 million words, more than three times the word count of the entire Harry Potter series.

They share some of the things they learned around creating a search engine ("it's hard") and what they ultimately ended up using - the Algolia service. The post talks about how they indexed the current documentation and broke it up into "chunks" of meaningful content. They also include the simple Javascript they use that links the search field to the Algolia service and renders the results using a view partial.

The proof of concept for the new search engine was a success and we decided to stop the ElasticSearch integration and stick with Algolia. The new search engine is greatly faster than the previous one and the search results are more accurate and relevant.
tagged: symfony documentation search engine new algolia service

Link: http://symfony.com/blog/the-new-symfony-documentation-search-engine


Trending Topics: