You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-12Lines changed: 31 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
3
3
**Import/Export Algolia settings, synonyms and query rules into your Laravel Scout project.**
4
4
5
-
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.
5
+
The easiest way to manage your settings is usually to go to your Algolia dashboard because it
6
+
has a nice UI and you can test the relevancy directly there.
6
7
7
8
Once you fine tuned your configuration, you may want to add it to your project.
8
9
@@ -11,7 +12,7 @@ This package adds two Laravel commands to your project:
11
12
- one to save your settings, synonyms and query rules into JSON files
12
13
- one to push everything back to Algolia
13
14
14
-
This has 3 majors advantages:
15
+
This has 3 major advantages:
15
16
16
17
1. You can version your configuration with your VCS
17
18
2. You can set up a new environment or restore backups easily
If you use Laravel 5.5, this package will take advantage of the [Package Auto-Discovery](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518) feature.
31
+
If you use Laravel 5.5, this package will take advantage of the
If you use an older version of Laravel, you will have to add the Service Provider to the `providers` array in `config/app.php`
37
+
If you use an older version of Laravel, you will have to add the Service Provider to
38
+
the `providers` array in `config/app.php`
36
39
37
40
```php
38
41
Algolia\Settings\ServiceProvider::class,
39
42
```
40
43
41
44
## Usage
42
45
43
-
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.
46
+
You will now get two new commands available in `artisan`. They both take a model's fully
47
+
qualified class name, just like Laravel Scout does to import/flush data.
44
48
45
49
The following example assume you have an `App\Contact` class, which uses the `Searchable` trait.
46
50
47
-
Note: Scout allows you to customize the index name with the [`searchableAs()`](https://laravel.com/docs/scout#configuring-model-indexes) method. This package will follow this naming convention.
51
+
Note: Scout allows you to customize the index name with the
52
+
[`searchableAs()`](https://laravel.com/docs/scout#configuring-model-indexes) method. This package
53
+
will follow this naming convention.
48
54
49
55
### Backing up settings (Project ⬅️ Algolia)
50
56
51
-
The following command will export all the settings and synonyms from the `App\Contact`'s index into the following files:
57
+
The following command will export all the settings and synonyms from the `App\Contact`'s
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.
77
+
The following command will read all the settings, synonyms and query rules from the
78
+
files in `resources/algolia-settings/` and import them into Algolia's index.
64
79
65
80
```
66
81
php artisan algolia:settings:push "App\Contact"
67
82
```
68
83
84
+
You can also pass the `--prefix` option, just like the backup command.
85
+
69
86
### Customizing directory
70
87
71
-
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`.
88
+
By default, settings, rules and synonyms are saved into the `resources/algolia-settings`.
89
+
The directory can be customized by the defining an environment variable named `ALGOLIA_SETTINGS_FOLDER`.
90
+
For example, the following command will save all the index resources into `resources/indexmeta`.
0 commit comments