Package Data | |
---|---|
Maintainer Username: | maxiloc |
Maintainer Contact: | julien.bourdeau@algolia.com (Julien Bourdeau) |
Package Create Date: | 2017-07-03 |
Package Last Update: | 2020-10-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:06:53 |
Package Statistics | |
---|---|
Total Downloads: | 391,457 |
Monthly Downloads: | 143 |
Daily Downloads: | 4 |
Total Stars: | 23 |
Total Watchers: | 68 |
Total Forks: | 12 |
Total Open Issues: | 0 |
DEPRECATED: Use of this repository is deprecated. Please use Scout Extended - https://github.com/algolia/scout-extended instead.
Import/Export Algolia settings, synonyms and query rules into your Laravel Scout project.
The easiest way to manage your settings is usually to go to your Algolia dashboard because it has a nice UI and you can test the relevancy directly there.
Once you fine tuned your configuration, you may want to add it to your project.
This package adds two Laravel commands to your project:
This has 3 major advantages:
Install this package with composer
composer require algolia/laravel-scout-settings
If you use Laravel 5.5, this package will take advantage of the Package Auto-Discovery feature. Nothing more to do to register the commands.
If you use an older version of Laravel, you will have to add the Service Provider to
the providers
array in config/app.php
Algolia\Settings\ServiceProvider::class,
You will now get two new commands available in artisan
. They both take a model's fully
qualified class name, just like Laravel Scout does to import/flush data.
The following example assume you have an App\Contact
class, which uses the Searchable
trait.
Note: Scout allows you to customize the index name with the
searchableAs()
method. This package
will follow this naming convention.
The following command will export all the settings and synonyms from the App\Contact
's
index into the following files:
resources/algolia-settings/index_name.json
resources/algolia-settings/index_name-synonyms.json
resources/algolia-settings/index_name-rules
php artisan algolia:settings:backup "App\Contact"
Note that if you want to add the prefix to your file names (which was the default behavior in v1),
you can pass the --prefix
option.
php artisan algolia:settings:backup "App\Contact" --prefix
The following command will read all the settings, synonyms and query rules from the
files in resources/algolia-settings/
and import them into Algolia's index.
php artisan algolia:settings:push "App\Contact"
You can also pass the --prefix
option, just like the backup command.
By default, settings, rules and synonyms are saved into the resources/algolia-settings
.
The directory can be customized by the defining an environment variable named ALGOLIA_SETTINGS_FOLDER
.
For example, the following command will save all the index resources into resources/indexmeta
.
ALGOLIA_SETTINGS_FOLDER=indexmeta php artisan algolia:settings:backup
composer test
Feel free to open a thread on our Community forum
Contributions are welcome!