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

Use VariableNode on "settings" configuration #370

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

pan93412
Copy link
Contributor

@pan93412 pan93412 commented Dec 3, 2024

Pull Request

Related issue

Fixes #369

What does this PR do?

"arrayNode" does not support arbitrary configuration keys. Therefore, I switch to variableNode with dynamic check.

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?

Thank you so much for contributing to Meilisearch!

@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch from e35b4d5 to 492623f Compare December 3, 2024 04:08
@norkunas
Copy link
Collaborator

norkunas commented Dec 3, 2024

note: in future we'll switch to fully defined settings structure

@pan93412 pan93412 marked this pull request as ready for review December 3, 2024 07:06
@pan93412 pan93412 closed this Dec 3, 2024
@pan93412 pan93412 reopened this Dec 3, 2024
@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch 2 times, most recently from 7e6113e to 4577461 Compare December 3, 2024 07:21
@pan93412 pan93412 changed the title fix(configuration): Use VariableNode on "settings" Use VariableNode on "settings" Dec 3, 2024
"arrayNode" does not support arbitrary configuration keys. Therefore, I switch to variableNode with dynamic check.

Fixed meilisearch#369
@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch from 4577461 to 7aa5aac Compare December 3, 2024 07:26
@pan93412 pan93412 changed the title Use VariableNode on "settings" Use VariableNode on "settings" configuration Dec 3, 2024
@pan93412
Copy link
Contributor Author

pan93412 commented Dec 3, 2024

@norkunas Seems like it generates a ConfigBuilder that allow passing arbitrary array.

CleanShot 2024-12-03 at 15 32 02@2x

Sadly, I cannot make it work locally. It might not the fault of my code in this PR; maybe I need some additional code to make it registered?

CleanShot 2024-12-03 at 15 33 30@2x

@norkunas
Copy link
Collaborator

norkunas commented Dec 3, 2024

I'm not sure how to test that in a bundle

@pan93412
Copy link
Contributor Author

pan93412 commented Dec 3, 2024

I'm not sure how to test that in a bundle

https://symfony.com/doc/current/configuration.html#using-php-configbuilders; however, I afraid the types are generated only on the consumer. I don't really find a way to test it just in this bundle.

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.73%. Comparing base (b820dda) to head (acf34e4).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #370      +/-   ##
============================================
+ Coverage     88.69%   88.73%   +0.03%     
  Complexity        1        1              
============================================
  Files            20       20              
  Lines           911      914       +3     
============================================
+ Hits            808      811       +3     
  Misses          103      103              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch from 5eda9ab to 43dc7b3 Compare December 3, 2024 08:31
@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch from 43dc7b3 to 9fafbff Compare December 3, 2024 08:31
@pan93412 pan93412 force-pushed the use-variable-node-on-settings branch from 59c728f to acf34e4 Compare December 3, 2024 09:59
@norkunas
Copy link
Collaborator

norkunas commented Dec 3, 2024

bors merge

@meili-bors meili-bors bot merged commit 82afbe3 into meilisearch:main Dec 3, 2024
20 checks passed
@pan93412 pan93412 deleted the use-variable-node-on-settings branch December 3, 2024 10:41
@norkunas
Copy link
Collaborator

norkunas commented Dec 3, 2024

Thank you @pan93412

@curquiza curquiza added the bug Something isn't working label Dec 3, 2024
meili-bors bot added a commit that referenced this pull request Dec 3, 2024
371: Fix: Container extension "meili_search" is not registered. r=norkunas a=pan93412

# Pull Request

## Related issue

#370 (comment)

## What does this PR do?

"meili_search" does not match the bundle name, "meilisearch," which causes some strange bugs, such as this issue.

I have completed a basic smoke test of PHP and YAML. I can confirm that the PHP configuration is now working with the Meilisearch bundle, while the old YAML configuration should function as it did before.

```bash
$ php bin/console meilisearch:import --update-settings
Importing for index App\Entity\Question
Indexed a batch of 70 / 70 App\Entity\Question entities into dev_questions index (70 indexed since start)
Setting "filterableAttributes" updated of "dev_questions".
Setting "sortableAttributes" updated of "dev_questions".
Done!
```

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Yi-Jyun Pan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot define "indices.settings" of MeilisearchConfig with PHP
3 participants