Skip to content

Commit d7becc4

Browse files
🎉 Release 2.0.0
1 parent 665a9a5 commit d7becc4

File tree

3 files changed

+57
-14
lines changed

3 files changed

+57
-14
lines changed

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
# Changelog
22

3+
## 2.0.0
4+
5+
* Better message in console
6+
* Do not use prefix in file names
7+
8+
In a typical workflow, you would use a different `scout.prefix` for
9+
each environment. Generally, you work on dev env, tweak settings in the
10+
dashboard, save them to your project with `php artisan algolia:settings:backup`
11+
and push them to your new index with you go to prod env.
12+
Because in v1 we would link all resources to the full index, if you
13+
use a different prefix, you weren't able to do this.
14+
In case you want to keep the behavior like in v1, pass the `--prefix` option
15+
to the 2 commands.
16+
17+
See [issue #14](https://github.com/algolia/laravel-scout-settings/issues/14)
18+
19+
* Introduce new IndexResourceRepository service class
20+
21+
This service allows you to read and write files with your settings,
22+
synonyms, rules via simple methods. This class doesn't interact with
23+
Algolia's API but with files in your `resources` folder.
24+
Thanks @qrazi
25+
26+
327
### 1.0.1
428

529
* Move UserAgent definition to ServiceProvider
6-
* Add compatibility withs Scout ^4.0 (Thanks to @tomcoonen)
30+
* Add compatibility with Scout ^4.0 (Thanks to @tomcoonen)
731

832
## 1.0.0
933

README.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
**Import/Export Algolia settings, synonyms and query rules into your Laravel Scout project.**
44

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.
67

78
Once you fine tuned your configuration, you may want to add it to your project.
89

@@ -11,7 +12,7 @@ This package adds two Laravel commands to your project:
1112
- one to save your settings, synonyms and query rules into JSON files
1213
- one to push everything back to Algolia
1314

14-
This has 3 majors advantages:
15+
This has 3 major advantages:
1516

1617
1. You can version your configuration with your VCS
1718
2. You can set up a new environment or restore backups easily
@@ -27,48 +28,66 @@ composer require algolia/laravel-scout-settings
2728

2829
#### Laravel 5.5
2930

30-
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
32+
[Package Auto-Discovery](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518) feature.
3133
Nothing more to do to register the commands.
3234

3335
#### Laravel 5.4 and prior
3436

35-
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`
3639

3740
```php
3841
Algolia\Settings\ServiceProvider::class,
3942
```
4043

4144
## Usage
4245

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.
4448

4549
The following example assume you have an `App\Contact` class, which uses the `Searchable` trait.
4650

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.
4854

4955
### Backing up settings (Project ⬅️ Algolia)
5056

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
58+
index into the following files:
5259

53-
* **Settings**: `resources/algolia-settings/prefix_index_name.json`
54-
* **Synonyms**: `resources/algolia-settings/prefix_index_name-synonyms.json`
55-
* **Query Rules**: `resources/algolia-settings/prefix_index_name-rules`
60+
* **Settings**: `resources/algolia-settings/index_name.json`
61+
* **Synonyms**: `resources/algolia-settings/index_name-synonyms.json`
62+
* **Query Rules**: `resources/algolia-settings/index_name-rules`
5663

5764
```
5865
php artisan algolia:settings:backup "App\Contact"
5966
```
6067

68+
Note that if you want to add the prefix to your file names (which was the default behavior in v1),
69+
you can pass the `--prefix` option.
70+
71+
```
72+
php artisan algolia:settings:backup "App\Contact" --prefix
73+
```
74+
6175
### Pushing settings (Project ➡️ Algolia)
6276

63-
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.
6479

6580
```
6681
php artisan algolia:settings:push "App\Contact"
6782
```
6883

84+
You can also pass the `--prefix` option, just like the backup command.
85+
6986
### Customizing directory
7087

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`.
7291

7392
```
7493
ALGOLIA_SETTINGS_FOLDER=indexmeta php artisan algolia:settings:backup

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
final class ServiceProvider extends LaravelServiceProvider
1414
{
15-
const VERSION = '1.0.0';
15+
const VERSION = '2.0.0';
1616

1717
public function boot()
1818
{

0 commit comments

Comments
 (0)