Skip to content

Conversation

alexksikes
Copy link
Contributor

Relates to #10217

This PR is against the query-refactoring branch.

return INT_FIELD_NAME;
case 3:
return DOUBLE_FIELD_NAME;
default:
Copy link
Member

Choose a reason for hiding this comment

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

make this case 4 instead of default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the method needs to return though

Copy link

Choose a reason for hiding this comment

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

As this is only in the test I think we are save assuming that randomIntBetween can only return values between 0 and 3, so leaving the largest value as default should be ok. Current implementation is fine as well of course.

@javanna
Copy link
Member

javanna commented Jul 6, 2015

left two tiny comments, looks good though

@alexksikes
Copy link
Contributor Author

@javanna Thanks for the review. I updated the PR accordingly.

case 3:
return DOUBLE_FIELD_NAME;
}
return randomAsciiOfLengthBetween(1, 10);
Copy link
Member

Choose a reason for hiding this comment

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

before you would randomly return unmapped field names, now you never do. randomIntBetween(0, 4) was ok, case 4 was ok too, you can just throw UnsupportedOperationException from the default or something.

@javanna
Copy link
Member

javanna commented Jul 8, 2015

left a couple of minor comments, @cbuescher do you mind having a look too?

@@ -51,6 +69,10 @@ public MissingQueryBuilder nullValue(boolean nullValue) {
return this;
}

public boolean nullValue() {
Copy link
Member

Choose a reason for hiding this comment

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

Reading just the method name, I was curious what it means in this context. Maybe short comment?

Copy link
Member

Choose a reason for hiding this comment

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

good point, actually given that it's a public method some javadocs wouldn't hurt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I'll add these, thanks for seeing this.

@cbuescher
Copy link
Member

Also did a round of reviews, left some remarks.

@alexksikes
Copy link
Contributor Author

@javanna @cbuescher thanks for the review. I updated the PR accordingly.

QueryParseContext context = createContext();
context.setAllowUnmappedFields(true);
try {
missingQueryBuilder.toQuery(context);
Copy link
Member

Choose a reason for hiding this comment

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

I would rather test this by calling the newFilter static method. In fact the check that we left there instead of relying on validate is there ony to protect other code paths from the outside (newFilter is public)

@javanna
Copy link
Member

javanna commented Jul 13, 2015

did another round, left a few small comments

@alexksikes
Copy link
Contributor Author

@javanna I updated the PR. Thanks.

this.name = name;
public MissingQueryBuilder(String fieldPattern) {
if (fieldPattern == null) {
throw new IllegalArgumentException("missing must be provided with a field");
Copy link

Choose a reason for hiding this comment

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

Does this work? Above PROTOTYPE is initialized with null which will result in an exception being thrown here.

@MaineC
Copy link

MaineC commented Jul 14, 2015

Left a few comments.

@alexksikes
Copy link
Contributor Author

@MaineC Thanks for the review. I updated the PR.

@alexksikes alexksikes force-pushed the feature/query-refactoring-missing branch from d9398ce to 64a50fd Compare July 23, 2015 15:23
@alexksikes
Copy link
Contributor Author

@javanna It's rebased you can take a look. Thank you.


private Boolean nullValue = DEFAULT_NULL_VALUE;

private Boolean existence = DEFAULT_EXISTENCE_VALUE;
Copy link
Member

Choose a reason for hiding this comment

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

should we move to primitive booleans here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I think we can and should.

@javanna
Copy link
Member

javanna commented Jul 23, 2015

left one minor comment

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

This PR is against the query-refactoring branch.
@alexksikes alexksikes closed this Jul 24, 2015
@alexksikes alexksikes force-pushed the feature/query-refactoring-missing branch from 9f1e6e6 to a4e9f64 Compare July 24, 2015 09:49
@alexksikes alexksikes deleted the feature/query-refactoring-missing branch July 24, 2015 10:07
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
Relates to elastic#10217
Closes elastic#12030

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.

5 participants