Skip to content

Conversation

MaineC
Copy link

@MaineC MaineC commented Jun 26, 2015

Separates JSON parsing from Lucene query creation, adds support for streaming, hashCode and equals as well as unit tests.

Relates to #10217

@cbuescher assigning to you for a first round of reviews. Not particularly happy with the createExpectedQuery implementation at the moment.

Copy link
Member

Choose a reason for hiding this comment

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

We changed the boost default to 1.0f in the other builders, should we do this here to for consistency? Can't add this comment on the top where the default is set.

@cbuescher
Copy link
Member

I went through it and it looks like there only a few minor changes to address. Left a few comments.

@MaineC
Copy link
Author

MaineC commented Jun 26, 2015

Thanks for your comments. Looking into the changes needed.

@MaineC MaineC assigned MaineC and unassigned cbuescher Jun 26, 2015
@MaineC MaineC force-pushed the feature/filter-query-builder-refactoring branch from 12f119f to 6dfeccc Compare June 29, 2015 19:41
@MaineC
Copy link
Author

MaineC commented Jun 29, 2015

@cbuescher I believe I addressed your comments. Added call to AbstractQueryBuilder#doXContentInnerBuilder in doXContent - happy to remove if #11915 comes in before this one.

Copy link
Member

Choose a reason for hiding this comment

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

Can't find validate() here. I think we went for always having empty implementation in builder class, even if there's nothing to validate.

Copy link
Member

Choose a reason for hiding this comment

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

it wouldn't be empty here at this point, it needs to validate the inner query and filter, see #11889

Copy link
Member

Choose a reason for hiding this comment

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

this will need to become protected doToQuery as soon as you rebase

@cbuescher
Copy link
Member

Left one very minor comment, otherwise LGTM. Some of the code concerning null-checks for inner queries can be changed once #11915 is on feature branch. @javanna can you also have a look?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see why the suppress warnings are needed here and in the previous method. Can you clarify that?

Copy link
Author

Choose a reason for hiding this comment

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

NamedWritable is a parameterised type so the compiler will complain when used w/o a parameter.

There's a few ways out: Specify the exact type of NamedWriteable that will be written in this location - clearly not an option at compile time here. Specify <?> instead of leaving the raw type - this would trickle down to any classes using this method, including e.g. the list of must clauses in BoolQueryBuilder and imply that all entries in that list need to be of the same type - not a good idea neither. The only way to get rid of the warning I saw was to disable with SuppressWarnings. (javac -X gave the hint on which warnings the JDK I use supports as part of the static analysis)

Checked the codebase for other uses of the annotation found it only in org/elasticsearch/search/aggregations/metrics/ScriptedMetricTests.java and org/elasticsearch/search/aggregations/pipeline/SiblingPipelineAggregator.java so I suppose we don't care too much about it. Happy to remove the annotations I added.

Copy link
Member

Choose a reason for hiding this comment

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

alright, I do get unchecked warnings when it comes to generics, but not these ones, it is just the level of the warnings in the IDE. I agree we don't usually suppress these, I think we can remove.

@MaineC MaineC force-pushed the feature/filter-query-builder-refactoring branch from 6dfeccc to ef95d8c Compare July 1, 2015 09:36
@MaineC
Copy link
Author

MaineC commented Jul 1, 2015

Left some explanations and updated the PR.

@MaineC MaineC added the review label Jul 1, 2015
@javanna
Copy link
Member

javanna commented Jul 6, 2015

left a few comments, @cbuescher please have a look too :)

@cbuescher
Copy link
Member

Also went through the changes once again, would prefer null-checks in constructors as well, left some more remarks.

@MaineC MaineC force-pushed the feature/filter-query-builder-refactoring branch from da4fa26 to fd12784 Compare July 7, 2015 08:41
@MaineC
Copy link
Author

MaineC commented Jul 7, 2015

Went through your comments and updated the PR (noticed only after pushing that one of the questions I had left was answered by both of you in the mean time - you are too fast answering questions). Updated code is ready for another look.

@cbuescher
Copy link
Member

@MaineC left a few comments, sorry I didn't realize I should not to that on the individual commits but rather on the overall change. Will do so next time.

Copy link
Member

Choose a reason for hiding this comment

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

what happened here?

Copy link
Author

Choose a reason for hiding this comment

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

Meh.

@javanna
Copy link
Member

javanna commented Jul 7, 2015

I did another round of review, left some comments. I'd need @cbuescher to have another look too though :)

Copy link
Member

Choose a reason for hiding this comment

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

Boost will be set in BaseQueryTestCase. No harm here, but doppelt gemoppelt (I want to try to gradually introduce this expression into the english vocabulary like Kindergarten and Schadenfreude) ;-)

Copy link
Member

Choose a reason for hiding this comment

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

:) good catch

@cbuescher
Copy link
Member

Also did another round of reviews and left some comments, mostly minor stuff. Agree that the query null-check in the parser doesn't need to be there, happy to clear this up more if there are questions remaining.

@MaineC MaineC force-pushed the feature/filter-query-builder-refactoring branch from fd12784 to 68c806e Compare July 8, 2015 08:37
@MaineC
Copy link
Author

MaineC commented Jul 8, 2015

Ready for another look.

Copy link
Member

Choose a reason for hiding this comment

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

minor thing but how about getting rid of the result variable and just return the query from the if?

@javanna
Copy link
Member

javanna commented Jul 8, 2015

LGTM besides the two minor comments I left

…treaming, hashCode and equals as well as unit tests.

Relates to elastic#10217
@MaineC MaineC force-pushed the feature/filter-query-builder-refactoring branch from 68c806e to 0202c99 Compare July 8, 2015 08:56
MaineC pushed a commit that referenced this pull request Jul 8, 2015
…factoring

Refactors FilteredQueryBuilder.

Relates to #10217
@MaineC MaineC merged commit a0cccec into elastic:feature/query-refactoring Jul 8, 2015
@MaineC MaineC removed the review label Jul 8, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…lder-refactoring

Refactors FilteredQueryBuilder.

Relates to elastic#10217
@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.

5 participants