Skip to content

Conversation

@alexksikes
Copy link
Contributor

Relates to #10217

This PR is against the query-refactoring branch.

Copy link
Member

Choose a reason for hiding this comment

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

given that the parser will never pass in null here, I think we could add a null check here as we did in other queries, so that if somebod using the java api sets null will get back error immediately. then we could remove the check from validate

@javanna
Copy link
Member

javanna commented Jul 11, 2015

left a small comment, looks good besides that

@alexksikes alexksikes force-pushed the feature/query-refactoring-script-query branch from 8f976c2 to 722ebac Compare July 13, 2015 16:36
@alexksikes
Copy link
Contributor Author

@javanna I updated the PR and rebased it. Thanks for the review.

Copy link
Member

Choose a reason for hiding this comment

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

can you please look at how we do this in other queries and do the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure what to know you mean by do the same as in other queries. Can you point me to a particular query? Maybe I'm missing something, but it seems we had settled for not checking for null in the constructor, and only do it in validate. Checking for null in the constructor would make the tests fail because of our prototype pattern, unless we use empty constructors.

Copy link
Member

Choose a reason for hiding this comment

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

look at BoostingQueryBuilder for instance. I explained in other PR when it makes sense to have checks in setter/constructors rather than validate, this is something that we are adapting as we go. I will say it again: check in setters/constructors are for things that can happen only through java api. depending on the parser, we might check for existence of elements in the parsers, meaning that null values will never come through from the parser to the builder. In that case null checks are only for the java api code and can be moved earlier on. If the check is valid for both rest layer (parser) and java api, then we should have the check in the validate method.

@alexksikes
Copy link
Contributor Author

@javanna Thanks for the review. I updated the PR, please see my response to your comment.

alexksikes added a commit that referenced this pull request Jul 24, 2015
Relates to #10217
Closes #12115

This PR is against the query-refactoring branch.
@alexksikes alexksikes closed this Jul 24, 2015
@alexksikes alexksikes force-pushed the feature/query-refactoring-script-query branch from a1b9d44 to 7099e6c Compare July 24, 2015 10:20
@alexksikes alexksikes deleted the feature/query-refactoring-script-query branch July 24, 2015 10:20
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
Relates to elastic#10217
Closes elastic#12115

This PR is against the query-refactoring branch.
@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

: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.

3 participants