Skip to content

Allow to use services for settings #253

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

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

norkunas
Copy link
Collaborator

Pull Request

Related issue

Fixes #248

What does this PR do?

  • Allows services to be used in index settings configuration and consumed on index create/import.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Opened a a POC so we can discuss if this is the way to go :)

Things to notice:

  • We should probably split CommandsTest someday into multiple test files and use different config files, as now when you add a separate config for test most of tests output must also be updated.
  • Not validating the configuration schema properly is error prone. Had some hard times when just got Meilisearch\Exceptions\ApiException: Json deserialize error: invalid type: map, expected a sequence at line 1 column 0 and how should I know which config setting is related? So imho we should properly validate all the settings for a better DX.

@norkunas norkunas force-pushed the dynamic-settings branch 4 times, most recently from 5ad205c to a1a24be Compare May 22, 2023 04:39
@brunoocasali
Copy link
Member

Not validating the configuration schema properly is error prone. Had some hard times when just got Meilisearch\Exceptions\ApiException: Json deserialize error: invalid type: map, expected a sequence at line 1 column 0 and how should I know which config setting is related? So imho we should properly validate all the settings for a better DX.

Can you generate an issue based on this comment @norkunas?

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

Hi @norkunas, sorry for the massive delay in reviewing your PR.

I'm suggesting a change to include an interface instead of using the invocation directly. I think it would be more idiomatic + easier to detect errors and evolve the code.

@brunoocasali brunoocasali added the enhancement New feature or request label Jun 9, 2023
@norkunas norkunas force-pushed the dynamic-settings branch 3 times, most recently from e1b5b02 to e284b5f Compare June 12, 2023 06:44
@@ -9,6 +9,7 @@
use Meilisearch\Bundle\Exception\TaskException;
use Meilisearch\Bundle\Model\Aggregator;
use Meilisearch\Bundle\SearchService;
use Meilisearch\Bundle\SettingsProvider;
Copy link
Member

Choose a reason for hiding this comment

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

Is there any requirement to have the Interface suffix?

SettingsProviderInterface

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SearchService is also an interface, so avoided

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I think we could have the Interface suffix on both. But it could be done later I'll create a new issue to make this repo PSR complaint https://www.php-fig.org/psr/

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

bors merge

@meili-bors meili-bors bot merged commit 1aa612e into meilisearch:main Jun 12, 2023
@meili-bot
Copy link
Contributor

This message is sent automatically

Thank you very much for submitting your PR! Did you know that throughout the month of June we’re holding a rafle?
If you share the link to your merged PR in our #giveaway Discord channel, you’ll automatically join a lottery for a chance at winning some Meiliswag. 🙂
Don’t hesitate to join us: https://discord.com/channels/1006923006964154428/1111273670657200198

@norkunas norkunas deleted the dynamic-settings branch June 12, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic settings
3 participants