Skip to content

esign/laravel-scout-multi-word-database-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Scout database driver to match multiple words separately

Latest Version on Packagist Total Downloads GitHub Actions

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.

Installation

You can install the package via composer:

composer require esign/laravel-scout-multi-word-database-engine

The package will automatically register a service provider.

Usage

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');
    }
}

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages