-
Notifications
You must be signed in to change notification settings - Fork 25k
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: Moving parser NAME constant to corresponding query builder #11178
Query Refactoring: Moving parser NAME constant to corresponding query builder #11178
Conversation
As a further explanation: there were two cases where the 1:1 mapping from parsers to builders was not completely clear:
|
protected String parserName() { | ||
return BoolQueryParser.NAME; | ||
public String queryId() { | ||
return BoolQueryBuilder.NAME; |
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.
in all the builders, you can remove the class name, just return NAME
is enough.
good change! left a few comments |
127195f
to
59305dc
Compare
I rebased this PR after recent changes on feature branch and addressed the two comments above. The two main changes here:
|
builder.field("_name", queryName); | ||
} | ||
builder.endObject(); | ||
} |
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 thought we discussed (missing bits in the review comments) to leave this as-is and to not introduce FQueryFilterBuilder
as it is not needed. This change breaks bw compatibility as you pointed out, thus we should keep this class as-is, and if we do that it makes little sense to introduce a deprecated additional FQueryFilterBuilder
. The idea is that two parsers sharing the same builder should not be a problem....unless I am missing something.
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.
All right, will remove FQueryFilterBuilder then, put the NAME of the extra FQueryFilterParser somewhere else in the QueryFilterBuilder then.
I did another review round, thanks @cbuescher |
@javanna I had another round, mostly reverting some of the changes in my prevoius commits. |
if (queryName != null) { | ||
builder.field("_name", queryName); | ||
builder.field("_name", queryName); |
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.
too many tabs?
left a super minor comment on indentation, LGTM besides that |
… builder As part of the query refactoring, this PR moves the NAME field that currently identifies each query parser to the corresponding query builder. The reason for this, as discussed in elastic#11121 (comment), is that we need still need to be able to link parser and builder implementations, but that the query builder is independent of the parser (queries don't necessarily need to be coverted to XContent any more). Builders don't need to know about their parsers, but parsers need to be linked to their respective builders. Closes elastic#11178
f5a4e74
to
283fe90
Compare
…vename Query Refactoring: Moving parser NAME constant to corresponding query builder
… builder As part of the query refactoring, this PR moves the NAME field that currently identifies each query parser to the corresponding query builder. The reason for this, as discussed in elastic#11121 (comment), is that we need still need to be able to link parser and builder implementations, but that the query builder is independent of the parser (queries don't necessarily need to be coverted to XContent any more). Builders don't need to know about their parsers, but parsers need to be linked to their respective builders. Closes elastic#11178
…ring-movename Query Refactoring: Moving parser NAME constant to corresponding query builder
As part of the query refactoring, this PR moves the NAME field that currently identifies each query parser to the corresponding query builder. The reason for this, as discussed in #11121 (comment), is that we need still need to be able to link parser and builder implementations, but that the query builder is independent of the parser (queries don't necessarily need to be coverted to XContent any more). Builders don't need to know about their parsers, but parsers need to be linked to their respective builders.
This change does the following: