Search with
Our Meetup in May was all about search, more specifically Laravel Scout. In his talk, Jure Knezovic gave an insight into using Scout in combination with a database-driven driver and Meilisearch.
Scout is a driver-based solution for searching Eloquent models. Scout can be thought of as a link between Eloquent and the indexes of all searchable resources. Scout makes it easier to store these indexes in, for example, MySQL databases, Algolia, Meilisearch, or even other search index engines such as Elasticsearch.
Especially if you are a developer looking for an alternative to SQL queries, it is worth looking into Scout. Compared to "where like%" queries, for example, Scout is much clearer and therefore less prone to errors. The input itself is also simpler.
Code Laravel Scout im Vergleich
Scout is installed classically via the composer:
Composer require laravel/scout Php artisan vendor:publish –provider=”Laravel/Scout/ScoutServiceProvider”
After that the drivers, keys, prefixes, etc. have to be set in the config/scout.phpand use Searchable; has to be added to the models. Then the search can start.
For the successful implementation of Scout it must be defined in advance with toSearchableArray(), which columns of the model are searchable.
Voraussetzungen Installation Laravel Scout
How Laravel Scout behaves in practice with a database and Meilisearch as driver is shown in the video.
Meilisearch is an open source search engine that can be flexibly integrated into websites and applications. It is highly customizable and offers useful features such as the inclusion of synonyms, the exclusion of certain words or fields, and an individual typo tolerance.
This is also reflected in Jure's conclusion:
You don't want to
miss a Meetup anymore?
join now