Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Support Meilisearch index settings #669

Merged
merged 10 commits into from
Nov 29, 2022
Merged

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented Nov 23, 2022

This PR adds support for Meilisearch's index settings:

https://docs.meilisearch.com/learn/configuration/settings.html
https://docs.meilisearch.com/reference/api/settings.html

Through a new settings key on the scout.meilisearch config option, users will be able to define all the settings they need for their model indexes. These settings will be synced when the index is manually created through the scout:index command or whenever models get updated through the engine or when they use the new scout:sync-settings command.

'meilisearch' => [
    'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
    'key' => env('MEILISEARCH_KEY', null),
    'settings' => [
        'users' => [
            'filterableAttributes'=> ['id', 'name', 'email'],
        ],
    ],
],

@driesvints driesvints changed the title improve meilisearch Support Meilisearch index settings Nov 23, 2022
@driesvints driesvints changed the title Support Meilisearch index settings [9.x] Support Meilisearch index settings Nov 23, 2022
@driesvints
Copy link
Member Author

@mmachatschek I'd appreciate a review here if you're up for it : )

Copy link
Contributor

@mmachatschek mmachatschek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me 👍 I'm just concerned about one change:

@driesvints driesvints marked this pull request as draft November 24, 2022 14:55
Copy link
Contributor

@mmachatschek mmachatschek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driesvints this is a nice addition. thats basically the same code that I use in my environment. I didn't test your code but it looks rock solid 👍

#669 (comment)

@driesvints
Copy link
Member Author

Thanks!

@driesvints driesvints marked this pull request as ready for review November 25, 2022 13:52
@taylorotwell taylorotwell merged commit 649d5bb into 9.x Nov 29, 2022
@taylorotwell taylorotwell deleted the improve-meilisearch branch November 29, 2022 18:18
@Bjornftw
Copy link

Bjornftw commented Dec 14, 2022

This is for everyone who is trying to add Meilisearch settings with @driesvints comment:

The settings key is renamed to index-settings instead of settings. settings will give you a No index settings found for the "meilisearch" engine. error.

Updated version:

'meilisearch' => [
    'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
    'key' => env('MEILISEARCH_KEY', null),
    'index-settings' => [
        'users' => [
            'filterableAttributes' => ['id', 'name', 'email'],
        ],
    ],
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants