sanjabteam/laravel-scout-database-driver

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel scout database driver.

v1.0.1 2021-05-18 10:00 UTC

This package is auto-updated.

Last update: 2022-06-17 15:45:00 UTC


README

⚠️ Deprecated: Laravel scout now supports database and collection drivers for testing purpose

Laravel Scout Database Driver

Latest Stable Version Total Downloads Build Status Code Style Code Coverage License

Database driver for Laravel scout.

Why?

Of-course search engines like algolia are faster and more accurate.

But you can use database driver for these purposes.

  1. You don't want to spend money on services like algolia now but you want your web app be flexible to use a search engine in future!
  2. You want to test your app in local environment without running a search engine on your local machine or use a online search engine service.

Installation

You can install the package via composer:

composer require sanjabteam/laravel-scout-database-driver
  • Requirements
    • Laravel 8 >=
    • Laravel Scout 8 >=

Run migrations:

php artisan migrate

And change scout default driver.

Configuration

You should change your default scout driver to database.

.env:

SCOUT_DRIVER=database

-- Or --

config/scout.php:

'driver' => 'database',

Add database specific configurations at end of scout config file.

config/scout.php:

<?php

return [
    // ...
    'driver' => ...

    // ..

    'database' => [
        // All optional database configurations here
        'connection' => ...,
        'mode' => ...,
    ],
];

All following configurations are optional

scout.database.connection:

Database connection to store search data. Change this if you don't want use your default database for search data.

scout.database.mode:

Search mode.

Possible values:

  • LIKE More strict, faster
  • LIKE_EXPANDED Less strict, slower

scout.database.relevance:

Relevance value for search query.

Check the source code to understand above configurations.

Limits

  • Order is not supported.

Contributing

Contributions are welcome!

Donation

donate.png

License

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