-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Query refactoring: function_score #13653
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
Query refactoring: function_score #13653
Conversation
90cba95 to
8404a24
Compare
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.
Would this read better if we used Objects.equals() like we do in other queries?
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.
yea it would read better, I only added the missing curly brackets while debugging failures till now, can change that too.
|
@javanna I left some comments, but looks really good |
|
@colings86 pushed new commits, added coverage and tests for enums (including operator that was missing tests, my bad) |
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.
we need a consolidation of all the score mode / type we have at some point, not here though
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.
+1
|
I pushed new commits that address the feedback, ready for another round of review. |
ad31082 to
4c26e7a
Compare
|
@colings86 @s1monw I went ahead and refactored all the functions too. Apologies for the size of the PR, should be close though. |
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.
Do we not also need a NAME constant here which is the name of this function in the NamedWriteableRegistry? Same with the other Functions
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.
getWriteableName is implemented once in the base ScoreFunctionBuilder and returns getName which was already there and implemented for all the functions.
|
LGTM |
Refactor the function_score query so it can be parsed on the coordinating node, split parse into fromXContent and toQuery, make FunctionScoreQueryBuilder Writeable. Closes elastic#13653
4c26e7a to
7eedd84
Compare
Refactor the function_score query so it can be parsed on the coordinating node, split parse into fromXContent and toQuery, make the builder writeable.
Found an issue with script_score function in tests, given that it accesses the shardId through SearchContext, but that's something that we don't have available and I am not sure how to make available. Added a TODO there, left out script_score from testing for now.
Simplified code around enums (boost mode and score mode), we now rely on enums for serialization and naming.
This change is breaking for the java api as it modifies FunctionScoreQueryBuilder, removes all the add method from it. Also breaking for plugins that implement custom score functions, see the migrate guide for more info.