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

Relax Settings::setMergePolicy value to allow int #2085

Merged
merged 3 commits into from
Jun 24, 2022

Conversation

franmomu
Copy link
Contributor

Ref: #2082 (comment)

Setting::setMergePolicy() second parameter:

* @param string $key Merge policy key (for ex. expunge_deletes_allowed)
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html
*/
public function setMergePolicy(string $key, string $value): Response

It expects a string, but in tests:

$settings->setMergePolicy('expunge_deletes_allowed', 15);
$this->assertEquals(15, $settings->getMergePolicy('expunge_deletes_allowed'));
$settings->setMergePolicy('expunge_deletes_allowed', 10);
$this->assertEquals(10, $settings->getMergePolicy('expunge_deletes_allowed'));

and looking at https://github.com/elastic/elasticsearch/blob/56d89577a033c15b518e2d74e55d9605eb90b78a/server/src/main/java/org/elasticsearch/index/MergePolicyConfig.java

seems like it could accept at least int as well based on the examples: https://github.com/elastic/elasticsearch/blob/56d89577a033c15b518e2d74e55d9605eb90b78a/server/src/main/java/org/elasticsearch/index/MergePolicyConfig.java#L39-L80

@franmomu franmomu changed the title Relax Setting::setMergePolicy value to allow int Relax Settings::setMergePolicy value to allow int Jun 22, 2022
@franmomu franmomu force-pushed the set_merge_policy branch 2 times, most recently from 19997c2 to c3bf13f Compare June 22, 2022 16:07
CHANGELOG.md Outdated
@@ -6,6 6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/ruflin/Elastica/compare/7.1.5...master)
### Backward Compatibility Breaks
* Changed `Settings::setMergePolicy` signature to allow to pass `int` and `string` as argument 2, if you are overriding this method you must update the signature removing the `string` type-hint.
Copy link
Owner

Choose a reason for hiding this comment

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

Just resolved the merge conflict but now looking at it again, I see the links to PR's are missing. Can you add it by chance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I've also added some other I missed

@ruflin ruflin merged commit 1e74607 into ruflin:master Jun 24, 2022
@franmomu franmomu deleted the set_merge_policy branch June 24, 2022 07:15
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.

2 participants