Skip to content

Conversation

@javanna
Copy link
Member

@javanna javanna commented Sep 18, 2015

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.

@javanna javanna force-pushed the refactor/function_score branch from 90cba95 to 8404a24 Compare September 18, 2015 11:24
Copy link
Contributor

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?

Copy link
Member Author

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.

@colings86
Copy link
Contributor

@javanna I left some comments, but looks really good

@javanna
Copy link
Member Author

javanna commented Sep 18, 2015

@colings86 pushed new commits, added coverage and tests for enums (including operator that was missing tests, my bad)

Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

+1

@javanna
Copy link
Member Author

javanna commented Sep 21, 2015

I pushed new commits that address the feedback, ready for another round of review.

@javanna javanna force-pushed the refactor/function_score branch 2 times, most recently from ad31082 to 4c26e7a Compare September 22, 2015 16:00
@javanna
Copy link
Member Author

javanna commented Sep 22, 2015

@colings86 @s1monw I went ahead and refactored all the functions too. Apologies for the size of the PR, should be close though.

Copy link
Contributor

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

Copy link
Member Author

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.

@s1monw
Copy link
Contributor

s1monw commented Sep 23, 2015

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
@javanna javanna force-pushed the refactor/function_score branch from 4c26e7a to 7eedd84 Compare September 23, 2015 09:40
@javanna javanna merged commit 7eedd84 into elastic:feature/query-refactoring Sep 23, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query Refactoring labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>breaking :Search/Search Search-related issues that do not fall into other categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants