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

Add positive_score_impact support for rank_features #2725

Merged
merged 4 commits into from
Apr 19, 2022
Merged

Add positive_score_impact support for rank_features #2725

merged 4 commits into from
Apr 19, 2022

Conversation

Hronom
Copy link
Contributor

@Hronom Hronom commented Apr 3, 2022

Description

Added support for positive_score_impact parameter for rank_features

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@Hronom Hronom requested a review from a team as a code owner April 3, 2022 21:42
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 4a953f8798ce4e6bf8be9d112b7d1d4ee20ff57e
Log 4082

Reports 4082

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 564f5759c33ed28f35353e5dbff290e97c122b15
Log 4085

Reports 4085

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 03cfab7
Log 4087

Reports 4087

Copy link
Collaborator

@nknize nknize left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! one little nitpick on creating the parameter list since we're at min java 11.

@@ -66,16 +76,20 @@ public Builder(String name) {

@Override
protected List<Parameter<?>> getParameters() {
return Collections.singletonList(meta);
ArrayList<Parameter<?>> result = new ArrayList<>(2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ArrayList<Parameter<?>> result = new ArrayList<>(2);
List.of(meta, positiveScoreImpact);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

@Override
public RankFeaturesFieldMapper build(BuilderContext context) {
return new RankFeaturesFieldMapper(
name,
new RankFeaturesFieldType(buildFullName(context), meta.getValue()),
new RankFeaturesFieldType(buildFullName(context), meta.getValue(), positiveScoreImpact.getValue()),
Copy link
Collaborator

@reta reta Apr 4, 2022

Choose a reason for hiding this comment

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

I see it being used by final Parameter<Boolean> positiveScoreImpact, the RankFeaturesFieldType could drop positiveScoreImpact and use it from RankFeaturesFieldType since it has a direct reference to it (sorry, copied from #2726 (comment))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@reta I just follow same style like it's done in:

  • org.opensearch.index.mapper.RankFeatureFieldMapper
  • org.opensearch.index.mapper.ScaledFloatFieldMapper

They also have it in Builders.

Also you can check that there meta on the same level and it's have same situation:

        private final Parameter<Boolean> positiveScoreImpact = Parameter.boolParam(
            "positive_score_impact",
            false,
            m -> ft(m).positiveScoreImpact,
            true
        );
        private final Parameter<Map<String, String>> meta = Parameter.metaParam();

I think it's better to be in the same style for now and if needed do refactoring for all places in separate PR.

However, I'm ok if maintainers of this repository do changes that is needed before merging this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 no objection from be, just feels a bit redundant

@nknize
Copy link
Collaborator

nknize commented Apr 6, 2022

Hi @Hronom! Thank you so much for submitting this! I was about to ask if you wanted to finish up the last few comments but saw you're in Ukraine. Our thoughts are with you and your family during these difficult times.

We are happy to tidy up these last few comments for you and commit on your behalf. Thank you so much for finding the time to contribute code to the project. We are extremely grateful!

@Hronom
Copy link
Contributor Author

Hronom commented Apr 9, 2022

@nknize thank you! I will try to add yours feedbacks now

Signed-off-by: Yevhen Tienkaiev <hronom@gmail.com>
@Hronom
Copy link
Contributor Author

Hronom commented Apr 9, 2022

Also feel free to make adjustments in this PR on my behalf, you have my approve for this!

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 7c14232
Log 4310

Reports 4310

@Hronom
Copy link
Contributor Author

Hronom commented Apr 9, 2022

Please check also this update to documentation opensearch-project/documentation-website#500 I think it will be good to make more people know about it.

@dblock dblock requested a review from kartg April 11, 2022 15:39
@Hronom Hronom requested a review from nknize April 17, 2022 00:02
Copy link
Collaborator

@nknize nknize left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for doing this!

@nknize nknize merged commit d8c815c into opensearch-project:main Apr 19, 2022
@nknize nknize added enhancement Enhancement or improvement to existing feature or request Indexing & Search v3.0.0 Issues and PRs related to version 3.0.0 backport 2.x Backport to 2.x branch labels Apr 19, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 19, 2022
Adds positive_score_impact support for rank_features field mapper.

Signed-off-by: Yevhen Tienkaiev <hronom@gmail.com>
(cherry picked from commit d8c815c)
dblock pushed a commit that referenced this pull request Apr 19, 2022
Adds positive_score_impact support for rank_features field mapper.

Signed-off-by: Yevhen Tienkaiev <hronom@gmail.com>
(cherry picked from commit d8c815c)

Co-authored-by: Yevhen Tienkaiev <hronom@gmail.com>
Copy link
Member

@kartg kartg left a comment

Choose a reason for hiding this comment

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

Late to the party, but 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch enhancement Enhancement or improvement to existing feature or request Indexing & Search v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants