Laravel Support¶
Laravel-RediSearch allows for indexing and searching Laravel models. It provides a Laravel Scout driver.
Getting Started¶
Install¶
composer install ethanhann/laravel-redisearch
Register the Provider¶
Add this entry to the providers array in config/app.php.
Ehann\LaravelRediSearch\RediSearchServiceProvider::class
Configure the Scout Driver¶
Update the Scout driver in config/scout.php.
'driver' => env('SCOUT_DRIVER', 'ehann-redisearch'),
Import a Model¶
Import a "Product" model that is configured to be searchable:
artisan ehann:redisearch:import App\\Product
Delete the index before importing:
artisan ehann:redisearch:import App\\Product --recreate-index
Import models without an ID field (this should be rarely needed):
artisan ehann:redisearch:import App\\Product --no-id
What now?¶
See the Laravel Scout documentation for additional information.