Skip to content
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: SpanContainingQueryBuilder and Parser #12057

Conversation

cbuescher
Copy link
Member

Moving the query building functionality from the parser to the builders
new toQuery() method analogous to other recent query refactorings.

PR is against query refactoring branch.

Relates to #10217

Moving the query building functionality from the parser to the builders
new toQuery() method analogous to other recent query refactorings.

Relates to elastic#10217
printBoostAndQueryName(builder);
builder.endObject();
}

@Override
protected Query doToQuery(QueryParseContext parseContext) throws IOException {
Query innerBig = big.toQuery(parseContext);
assert innerBig instanceof SpanQuery;
Copy link
Member

Choose a reason for hiding this comment

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

I think this assert may trip cause the result of toQuery might be null in case big is EmptyQueryBuilder?

Copy link
Member

Choose a reason for hiding this comment

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

we might have the same bug somewhere else I'm afraid

Copy link
Member Author

Choose a reason for hiding this comment

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

EmptyQueryBuilder can not be inner SpanQueryBuilder because of instanceof checks in parser, also can't be used here in constructor, so I think were good here? The whole nested SpanQueryBuilder hierarchy shouldn't suffer from this problem, in theory it would be possible to nest an empty { } in them but that already would not be accepted by the current DSL I think.

Copy link
Member

Choose a reason for hiding this comment

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

alrighty that makes sense now. Being paranoid, can't one set pass EmptyQueryBuilder.PROTOTYPE to the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if I understand what you mean.

Copy link
Member

Choose a reason for hiding this comment

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

you said that EmptyQueryBuilder can't be used here in constructor. Why not?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, because it only accepts SpanQueryBuilder arguments and EmptyQueryBuilder isn't one.

Copy link
Member

Choose a reason for hiding this comment

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

right, sorry! gotcha

@javanna
Copy link
Member

javanna commented Jul 6, 2015

left a few minor comments

@cbuescher
Copy link
Member Author

Changed the test query setup to use switch.

@javanna
Copy link
Member

javanna commented Jul 6, 2015

LGTM

cbuescher added a commit that referenced this pull request Jul 6, 2015
…ancontaining

Query refactoring: SpanContainingQueryBuilder and Parser
@cbuescher cbuescher merged commit 6c02301 into elastic:feature/query-refactoring Jul 6, 2015
@kevinkluge kevinkluge removed the review label Jul 6, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…ring-spancontaining

Query refactoring: SpanContainingQueryBuilder and Parser
@javanna
Copy link
Member

javanna commented Aug 28, 2015

This change is breaking for the java api as it removes setters for mandatory big/little inner span queries. Both arguments now have to be supplied at construction time instead and have to be non-null.

@cbuescher cbuescher deleted the feature/query-refactoring-spancontaining branch March 11, 2016 11:51
@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