diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-07-15 14:02:07 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-07-15 15:39:26 +0000 |
commit | 2c9bb768a2078fb15a6526d15637ba4dcf3adb15 (patch) | |
tree | 199daa8d363b7d2691fec1527187db6db4fd7781 /searchlib | |
parent | ef9ba8529ace59780fbc50ccb153336d44dc4a15 (diff) |
[lo,hi] -> [low,high]
Diffstat (limited to 'searchlib')
5 files changed, 56 insertions, 56 deletions
diff --git a/searchlib/src/tests/common/location/geo_location_test.cpp b/searchlib/src/tests/common/location/geo_location_test.cpp index 077faa42225..8093ea61697 100644 --- a/searchlib/src/tests/common/location/geo_location_test.cpp +++ b/searchlib/src/tests/common/location/geo_location_test.cpp @@ -51,10 +51,10 @@ TEST(GeoLocationTest, bounding_boxes_can_be_parsed) { EXPECT_EQ(0, loc.point.x); EXPECT_EQ(0, loc.point.y); EXPECT_EQ(std::numeric_limits<uint32_t>::max(), loc.radius); - EXPECT_EQ(10, loc.bounding_box.x.lo); - EXPECT_EQ(20, loc.bounding_box.y.lo); - EXPECT_EQ(30, loc.bounding_box.x.hi); - EXPECT_EQ(40, loc.bounding_box.y.hi); + EXPECT_EQ(10, loc.bounding_box.x.low); + EXPECT_EQ(20, loc.bounding_box.y.low); + EXPECT_EQ(30, loc.bounding_box.x.high); + EXPECT_EQ(40, loc.bounding_box.y.high); } TEST(GeoLocationTest, circles_can_be_parsed) { @@ -65,10 +65,10 @@ TEST(GeoLocationTest, circles_can_be_parsed) { EXPECT_EQ(10, loc.point.x); EXPECT_EQ(20, loc.point.y); EXPECT_EQ(5u, loc.radius); - EXPECT_EQ(5, loc.bounding_box.x.lo); - EXPECT_EQ(15, loc.bounding_box.y.lo); - EXPECT_EQ(15, loc.bounding_box.x.hi); - EXPECT_EQ(25, loc.bounding_box.y.hi); + EXPECT_EQ(5, loc.bounding_box.x.low); + EXPECT_EQ(15, loc.bounding_box.y.low); + EXPECT_EQ(15, loc.bounding_box.x.high); + EXPECT_EQ(25, loc.bounding_box.y.high); } TEST(GeoLocationTest, circles_can_have_aspect_ratio) { @@ -79,10 +79,10 @@ TEST(GeoLocationTest, circles_can_have_aspect_ratio) { EXPECT_EQ(10, loc.point.x); EXPECT_EQ(20, loc.point.y); EXPECT_EQ(5u, loc.radius); - EXPECT_EQ(-1, loc.bounding_box.x.lo); - EXPECT_EQ(15, loc.bounding_box.y.lo); - EXPECT_EQ(21, loc.bounding_box.x.hi); - EXPECT_EQ(25, loc.bounding_box.y.hi); + EXPECT_EQ(-1, loc.bounding_box.x.low); + EXPECT_EQ(15, loc.bounding_box.y.low); + EXPECT_EQ(21, loc.bounding_box.x.high); + EXPECT_EQ(25, loc.bounding_box.y.high); } TEST(GeoLocationTest, bounding_box_can_be_specified_after_circle) { @@ -93,10 +93,10 @@ TEST(GeoLocationTest, bounding_box_can_be_specified_after_circle) { EXPECT_EQ(10, loc.point.x); EXPECT_EQ(20, loc.point.y); EXPECT_EQ(5u, loc.radius); - EXPECT_EQ(10, loc.bounding_box.x.lo); - EXPECT_EQ(20, loc.bounding_box.y.lo); - EXPECT_EQ(15, loc.bounding_box.x.hi); - EXPECT_EQ(25, loc.bounding_box.y.hi); + EXPECT_EQ(10, loc.bounding_box.x.low); + EXPECT_EQ(20, loc.bounding_box.y.low); + EXPECT_EQ(15, loc.bounding_box.x.high); + EXPECT_EQ(25, loc.bounding_box.y.high); } TEST(GeoLocationTest, circles_can_be_specified_after_bounding_box) { @@ -107,30 +107,30 @@ TEST(GeoLocationTest, circles_can_be_specified_after_bounding_box) { EXPECT_EQ(10, loc.point.x); EXPECT_EQ(20, loc.point.y); EXPECT_EQ(5u, loc.radius); - EXPECT_EQ(10, loc.bounding_box.x.lo); - EXPECT_EQ(20, loc.bounding_box.y.lo); - EXPECT_EQ(15, loc.bounding_box.x.hi); - EXPECT_EQ(25, loc.bounding_box.y.hi); + EXPECT_EQ(10, loc.bounding_box.x.low); + EXPECT_EQ(20, loc.bounding_box.y.low); + EXPECT_EQ(15, loc.bounding_box.x.high); + EXPECT_EQ(25, loc.bounding_box.y.high); } TEST(GeoLocationTest, santa_search_gives_non_wrapped_bounding_box) { auto loc = parse("(2,122163600,89998536,290112,4,2000,0,109704)"); - EXPECT_GE(loc.bounding_box.x.hi, loc.bounding_box.x.lo); - EXPECT_GE(loc.bounding_box.y.hi, loc.bounding_box.y.lo); + EXPECT_GE(loc.bounding_box.x.high, loc.bounding_box.x.low); + EXPECT_GE(loc.bounding_box.y.high, loc.bounding_box.y.low); } TEST(GeoLocationTest, near_boundary_search_gives_non_wrapped_bounding_box) { auto loc1 = parse("(2,2000000000,2000000000,3000000000,0,1,0)"); - EXPECT_GE(loc1.bounding_box.x.hi, loc1.bounding_box.x.lo); - EXPECT_GE(loc1.bounding_box.y.hi, loc1.bounding_box.y.lo); - EXPECT_EQ(std::numeric_limits<int32_t>::max(), loc1.bounding_box.y.hi); - EXPECT_EQ(std::numeric_limits<int32_t>::max(), loc1.bounding_box.y.hi); + EXPECT_GE(loc1.bounding_box.x.high, loc1.bounding_box.x.low); + EXPECT_GE(loc1.bounding_box.y.high, loc1.bounding_box.y.low); + EXPECT_EQ(std::numeric_limits<int32_t>::max(), loc1.bounding_box.y.high); + EXPECT_EQ(std::numeric_limits<int32_t>::max(), loc1.bounding_box.y.high); auto loc2 = parse("(2,-2000000000,-2000000000,3000000000,0,1,0)"); - EXPECT_GE(loc2.bounding_box.x.hi, loc2.bounding_box.x.lo); - EXPECT_GE(loc2.bounding_box.y.hi, loc2.bounding_box.y.lo); - EXPECT_EQ(std::numeric_limits<int32_t>::min(), loc2.bounding_box.x.lo); - EXPECT_EQ(std::numeric_limits<int32_t>::min(), loc2.bounding_box.y.lo); + EXPECT_GE(loc2.bounding_box.x.high, loc2.bounding_box.x.low); + EXPECT_GE(loc2.bounding_box.y.high, loc2.bounding_box.y.low); + EXPECT_EQ(std::numeric_limits<int32_t>::min(), loc2.bounding_box.x.low); + EXPECT_EQ(std::numeric_limits<int32_t>::min(), loc2.bounding_box.y.low); } GTEST_MAIN_RUN_ALL_TESTS() diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 78c37a03609..cb587d77133 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -275,16 +275,16 @@ Blueprint::UP make_location_blueprint(const FieldSpec &field, const IAttributeVector &attribute, const Location &loc) { auto post_filter = std::make_unique<LocationPostFilterBlueprint>(field, attribute, loc); const common::Location &location = post_filter->location(); - if (location.bounding_box.x.lo > location.bounding_box.x.hi || - location.bounding_box.y.lo > location.bounding_box.y.hi) + if (location.bounding_box.x.low > location.bounding_box.x.high || + location.bounding_box.y.low > location.bounding_box.y.high) { return std::make_unique<queryeval::EmptyBlueprint>(field); } ZCurve::RangeVector rangeVector = ZCurve::find_ranges( - location.bounding_box.x.lo, - location.bounding_box.y.lo, - location.bounding_box.x.hi, - location.bounding_box.y.hi); + location.bounding_box.x.low, + location.bounding_box.y.low, + location.bounding_box.x.high, + location.bounding_box.y.high); auto pre_filter = std::make_unique<LocationPreFilterBlueprint>(field, attribute, rangeVector); if (!pre_filter->should_use()) { return post_filter; diff --git a/searchlib/src/vespa/searchlib/common/geo_location.cpp b/searchlib/src/vespa/searchlib/common/geo_location.cpp index 4b072713fdd..6dd7b83ae37 100644 --- a/searchlib/src/vespa/searchlib/common/geo_location.cpp +++ b/searchlib/src/vespa/searchlib/common/geo_location.cpp @@ -9,8 +9,8 @@ namespace search::common { namespace { ZCurve::BoundingBox to_z(GeoLocation::Box box) { - return ZCurve::BoundingBox(box.x.lo, box.x.hi, - box.y.lo, box.y.hi); + return ZCurve::BoundingBox(box.x.low, box.x.high, + box.y.low, box.y.high); } GeoLocation::Box @@ -38,11 +38,11 @@ adjust_bounding_box(GeoLocation::Box orig, GeoLocation::Point point, uint32_t ra int64_t implied_max_y = int64_t(point.y) + int64_t(radius); int64_t implied_min_y = int64_t(point.y) - int64_t(radius); - int32_t max_x = orig.x.hi; - int32_t min_x = orig.x.lo; + int32_t max_x = orig.x.high; + int32_t min_x = orig.x.low; - int32_t max_y = orig.y.hi; - int32_t min_y = orig.y.lo; + int32_t max_y = orig.y.high; + int32_t min_y = orig.y.low; if (implied_max_x < max_x) max_x = implied_max_x; if (implied_min_x > min_x) min_x = implied_min_x; @@ -171,11 +171,11 @@ uint64_t GeoLocation::sq_distance_to(Point p) const { } bool GeoLocation::inside_limit(Point p) const { - if (p.x < bounding_box.x.lo) return false; - if (p.x > bounding_box.x.hi) return false; + if (p.x < bounding_box.x.low) return false; + if (p.x > bounding_box.x.high) return false; - if (p.y < bounding_box.y.lo) return false; - if (p.y > bounding_box.y.hi) return false; + if (p.y < bounding_box.y.low) return false; + if (p.y > bounding_box.y.high) return false; uint64_t sq_dist = sq_distance_to(p); return sq_dist <= _sq_radius; diff --git a/searchlib/src/vespa/searchlib/common/geo_location.h b/searchlib/src/vespa/searchlib/common/geo_location.h index d94281a9178..5d04a09142a 100644 --- a/searchlib/src/vespa/searchlib/common/geo_location.h +++ b/searchlib/src/vespa/searchlib/common/geo_location.h @@ -16,8 +16,8 @@ namespace search::common { struct GeoLocation { // contained structs and helper constants: - static constexpr int32_t range_lo = std::numeric_limits<int32_t>::min(); - static constexpr int32_t range_hi = std::numeric_limits<int32_t>::max(); + static constexpr int32_t range_low = std::numeric_limits<int32_t>::min(); + static constexpr int32_t range_high = std::numeric_limits<int32_t>::max(); static constexpr uint32_t radius_inf = std::numeric_limits<uint32_t>::max(); struct Point { const int32_t x; @@ -31,13 +31,13 @@ struct GeoLocation bool active() const { return multiplier != 0; } }; struct Range { - const int32_t lo; - const int32_t hi; + const int32_t low; + const int32_t high; bool active() const { - return (lo != range_lo) || (hi != range_hi); + return (low != range_low) || (high != range_high); } }; - static constexpr Range no_range = {range_lo, range_hi}; + static constexpr Range no_range = {range_low, range_high}; struct Box { const Range x; const Range y; diff --git a/searchlib/src/vespa/searchlib/query/tree/location.cpp b/searchlib/src/vespa/searchlib/query/tree/location.cpp index 48f45c4ceca..6e678f9e682 100644 --- a/searchlib/src/vespa/searchlib/query/tree/location.cpp +++ b/searchlib/src/vespa/searchlib/query/tree/location.cpp @@ -60,10 +60,10 @@ Location::getOldFormatString() const << ")"; } if (bounding_box.active()) { - buf << "[2," << bounding_box.x.lo - << "," << bounding_box.y.lo - << "," << bounding_box.x.hi - << "," << bounding_box.y.hi + buf << "[2," << bounding_box.x.low + << "," << bounding_box.y.low + << "," << bounding_box.x.high + << "," << bounding_box.y.high << "]" ; } return buf.str(); |