-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
❌ Gradle Check failure 4a953f8798ce4e6bf8be9d112b7d1d4ee20ff57e |
❌ Gradle Check failure 564f5759c33ed28f35353e5dbff290e97c122b15 |
There was a problem hiding this 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayList<Parameter<?>> result = new ArrayList<>(2); | |
List.of(meta, positiveScoreImpact); |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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 Builder
s.
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.
There was a problem hiding this comment.
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
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! |
@nknize thank you! I will try to add yours feedbacks now |
Signed-off-by: Yevhen Tienkaiev <[email protected]>
Also feel free to make adjustments in this PR on my behalf, you have my approve for this! |
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. |
There was a problem hiding this 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!
Adds positive_score_impact support for rank_features field mapper. Signed-off-by: Yevhen Tienkaiev <[email protected]> (cherry picked from commit d8c815c)
Adds positive_score_impact support for rank_features field mapper. Signed-off-by: Yevhen Tienkaiev <[email protected]> (cherry picked from commit d8c815c) Co-authored-by: Yevhen Tienkaiev <[email protected]>
There was a problem hiding this 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 🚢
Description
Added support for
positive_score_impact
parameter forrank_features
Issues Resolved
[List any issues this PR will resolve]
Check List
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.