laravel / scout

Laravel Scout provides a driver based solution to searching your Eloquent models.
https://laravel.com/docs/scout
MIT License
1.54k stars 327 forks source link

Added possibility to version indexes. #836

Closed Boorinio closed 3 months ago

Boorinio commented 3 months ago

Hi everyone, This is a simple pr that adds the indexableAs method in the searchable trait.

Why?

Usage scenario:

  1. Users Model is searchable
  2. You define the indexableAs with return 'users_v2'
  3. You reimport everything in users_v2, meanwhile your website can still perform searches on the old index
  4. You deploy a new version of your code with the searchableAs returning 'users_v2'
  5. profit!
Boorinio commented 3 months ago

Thank you, much appreciated!! @taylorotwell