This package is an extension of Laravel Scout database driver to match multiple words separately. The default behaviour of the Laravel Scout database driver is to match the whole search query as a single string. This package allows you to match each word of the search query separately.
You can install the package via composer:
composer require esign/laravel-scout-multi-word-database-engine
The package will automatically register a service provider.
To use the multi-word database engine as a default, you may configure the SCOUT_DRIVER
environment variable in your .env
file to multi-word-database
.
To configure the multi-word database engine for a specific model, you may add the following property to the model:
use Laravel\Scout\Searchable;
use Laravel\Scout\Engines\Engine;
class Post extends Model
{
use Searchable;
public function searchableUsing(): Engine
{
return app(EngineManager::class)->engine('multi-word-database');
}
}
composer test
The MIT License (MIT). Please see License File for more information.