-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Port PrimitiveValueTest test for core::Query #1530
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
Conversation
(From java.) Also fix a bug uncovered by the test. (oops)
@@ -54,15 +54,15 @@ bool RelationFilter::MatchesValue(const FieldValue& other) const { | |||
bool RelationFilter::MatchesComparison(const FieldValue& other) const { | |||
switch (op_) { | |||
case Operator::LessThan: | |||
return value_ < other; | |||
return other < value_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: this looks a little counterintuitive now that the order has been changed, due to the names. Unfortunately, I don't really have a good suggestion, but even renaming value_
to rhs_
, though perhaps not elegant, would at least explain the ordering. (another rough idea is compare_what < compare_to_
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about the counterintuitive part (which is perhaps obvious, given that I originally reversed these!)
I've renamed value_
to value_rhs_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The travis failure was fixed in #1544. Merge the latest master to fix it. |
@@ -47,22 +49,22 @@ bool RelationFilter::Matches(const model::Document& doc) const { | |||
|
|||
bool RelationFilter::MatchesValue(const FieldValue& other) const { | |||
// Only compare types with matching backend order (such as double and int). | |||
return FieldValue::Comparable(value_.type(), other.type()) && | |||
return FieldValue::Comparable(value_rhs_.type(), other.type()) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now looks wrong (it's value_rhs_
but it's on the left).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
(From java.)
Also fix a bug uncovered by the test. (oops)