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

Remove QueryParseContext from parsing QueryBuilders #25448

Merged
merged 2 commits into from
Jun 29, 2017

Conversation

cbuescher
Copy link
Member

@cbuescher cbuescher commented Jun 28, 2017

Currently QueryParseContext is only a thin wrapper around an XContentParser that
adds little functionality of its own. It only provides helpers for long deprecated
field names which can be removed, and two helper methods that can be made static
and moved to other classes. This is a first step in helping to remove
QueryParseContext.

Currently QueryParseContext is only a thin wrapper around an XContentParser that
adds little functionality of its own. I provides helpers for long deprecated
field names which can be removed and two helper methods that can be made static
and moved to other classes. This is a first step in helping to remove
QueryParseContext entirely.
@@ -42,75 +34,4 @@ public QueryParseContext(XContentParser parser) {
public XContentParser parser() {
return this.parser;
}
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'm leaving this stub of the class here for now, otherwise the PR would have gotten very big. I have a follow up almost ready that removes the whole class, but that requires removal from all kinds of method signatures, aggregations etc...

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

I think now is a good time for this!

it's happening

@@ -267,8 +266,6 @@ public static FuzzyQueryBuilder fromXContent(QueryParseContext parseContext) thr
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (parseContext.isDeprecatedSetting(currentFieldName)) {
Copy link
Member

Choose a reason for hiding this comment

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

This breaks 1.x compatibility, which seems fine to me! Probably worth adding a note to the migration docs just in case.

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 will add a short note about those two fields.

* Creates a new {@link QueryBuilder} from the query held by the {@link QueryParseContext}
* in {@link org.elasticsearch.common.xcontent.XContent} format
* Creates a new {@link QueryBuilder} from the query held by the
* {@link QueryParseContext} in
Copy link
Member

Choose a reason for hiding this comment

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

This is not longer correct - more like "Creates a new QueryBuilder from the query represented by the xcontent in the parser." or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

* the input parse context. The state on the parser contained in
* this context will be changed as a side effect of this method
* call
* @param parser
Copy link
Member

Choose a reason for hiding this comment

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

At this point I don't know that @param adds anything either.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

assertEquals("request does not support [foo]", exception.getMessage());
}
}

public void testParseInnerQueryBuilder() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Probably worth moving this to AbstractQueryBuilder.

Copy link
Member Author

Choose a reason for hiding this comment

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

Already part of a follow-up PR. I can do it now if you prefer, but the test is split there anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Part of the followup is fine with me!

@nik9000
Copy link
Member

nik9000 commented Jun 29, 2017

Very happy to have this coming in! Glad to see the end of this tunnel.

@cbuescher
Copy link
Member Author

@nik9000 thanks for the review, after this context is gone there might be possibilities for more cleanups down the road.

@s1monw
Copy link
Contributor

s1monw commented Jun 29, 2017

Awesome that this can go!!!

@cbuescher cbuescher merged commit 927111c into elastic:master Jun 29, 2017
jasontedor added a commit that referenced this pull request Jun 30, 2017
* master: (129 commits)
  Add doc note regarding explicit publish host
  Fix typo in name of test
  Add additional test for sequence-number recovery
  WrapperQueryBuilder should also rewrite the parsed query.
  Remove dead code and stale Javadoc
  Update defaults in documentation (#25483)
  [DOCS] Add docs-dir to Painless (#25482)
  Add concurrent deprecation logger test
  [DOCS] Update shared attributes for Elasticsearch (#25479)
  Use LRU set to reduce repeat deprecation messages
  Add NioTransport threads to thread name checks (#25477)
  Add shortcut for AbstractQueryBuilder.parseInnerQueryBuilder to QueryShardContext
  Prevent channel enqueue after selector close (#25478)
  Fix Java 9 compilation issue
  Remove unregistered `transport.netty.*` settings (#25476)
  Handle ping correctly in NioTransport (#25462)
  Tests: Remove platform specific assertion in NioSocketChannelTests
  Remove QueryParseContext from parsing QueryBuilders (#25448)
  Promote replica on the highest version node (#25277)
  test: added not null assertion
  ...
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking-java :Search/Search Search-related issues that do not fall into other categories v6.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants