|
4 | 4 |
|
5 | 5 | use Illuminate\Support\LazyCollection; |
6 | 6 | use Laravel\Scout\Builder; |
| 7 | +use Laravel\Scout\Contracts\UpdatesIndexSettings; |
7 | 8 | use Laravel\Scout\Jobs\RemoveableScoutCollection; |
8 | 9 | use Meilisearch\Client as MeilisearchClient; |
9 | 10 | use Meilisearch\Contracts\IndexesQuery; |
10 | 11 | use Meilisearch\Meilisearch; |
11 | 12 | use Meilisearch\Search\SearchResult; |
12 | 13 |
|
13 | | -class MeilisearchEngine extends Engine |
| 14 | +class MeilisearchEngine extends Engine implements UpdatesIndexSettings |
14 | 15 | { |
15 | 16 | /** |
16 | 17 | * The Meilisearch client. |
@@ -383,17 +384,25 @@ public function createIndex($name, array $options = []) |
383 | 384 | } |
384 | 385 |
|
385 | 386 | /** |
386 | | - * Update an index's settings. |
| 387 | + * Update the index settings for the given index. |
387 | 388 | * |
388 | | - * @param string $name |
389 | | - * @param array $options |
390 | | - * @return array |
| 389 | + * @return void |
| 390 | + */ |
| 391 | + public function updateIndexSettings($name, array $settings = []) |
| 392 | + { |
| 393 | + $this->meilisearch->index($name)->updateSettings($settings); |
| 394 | + } |
| 395 | + |
| 396 | + /** |
| 397 | + * Configure the soft delete filter within the given settings. |
391 | 398 | * |
392 | | - * @throws \Meilisearch\Exceptions\ApiException |
| 399 | + * @return array |
393 | 400 | */ |
394 | | - public function updateIndexSettings($name, array $options = []) |
| 401 | + public function configureSoftDeleteFilter(array $settings = []) |
395 | 402 | { |
396 | | - return $this->meilisearch->index($name)->updateSettings($options); |
| 403 | + $settings['filterableAttributes'][] = '__soft_deleted'; |
| 404 | + |
| 405 | + return $settings; |
397 | 406 | } |
398 | 407 |
|
399 | 408 | /** |
|
0 commit comments