From 6abfeaca106f70daa32616dbec4ed39b2b9bb35c Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 10 Jul 2020 20:38:07 +0000 Subject: avoid evil setSpec implementation --- .../vespa/searchlib/attribute/attribute_blueprint_factory.cpp | 6 +++--- searchlib/src/vespa/searchlib/common/location.cpp | 11 ++--------- searchlib/src/vespa/searchlib/common/location.h | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) (limited to 'searchlib') diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 37480d6dbd4..f549885e94d 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -248,13 +248,13 @@ public: LocationPostFilterBlueprint(const FieldSpec &field, const IAttributeVector &attribute, const Location &loc) : ComplexLeafBlueprint(field), _attribute(attribute), - _location() + _location(loc) { + uint32_t estHits = 0; if (loc.isValid()) { _location.setVec(attribute); - _location.setSpec(loc); + estHits = _attribute.getNumDocs(); } - uint32_t estHits = _attribute.getNumDocs(); LOG(debug, "location %s in attribute with numdocs %u", loc.getDebugString().c_str(), estHits); HitEstimate estimate(estHits, estHits == 0); setEstimate(estimate); diff --git a/searchlib/src/vespa/searchlib/common/location.cpp b/searchlib/src/vespa/searchlib/common/location.cpp index 51476658953..d88c3ae7302 100644 --- a/searchlib/src/vespa/searchlib/common/location.cpp +++ b/searchlib/src/vespa/searchlib/common/location.cpp @@ -8,17 +8,10 @@ namespace search::common { Location::Location() : _zBoundingBox(0,0,0,0) {} Location::Location(const GeoLocationSpec &other) - : Location() -{ - setSpec(other); -} - -void -Location::setSpec(const GeoLocationSpec &other) + : GeoLocationSpec(other), + _zBoundingBox(0,0,0,0) { using vespalib::geo::ZCurve; - - GeoLocationSpec::operator=(other); if (isValid()) { _zBoundingBox = ZCurve::BoundingBox(getMinX(), getMaxX(), getMinY(), getMaxY()); diff --git a/searchlib/src/vespa/searchlib/common/location.h b/searchlib/src/vespa/searchlib/common/location.h index 29f3c71fdb5..df8f130ce70 100644 --- a/searchlib/src/vespa/searchlib/common/location.h +++ b/searchlib/src/vespa/searchlib/common/location.h @@ -24,7 +24,6 @@ public: bool getzFailBoundingBoxTest(int64_t docxy) const { return _zBoundingBox.getzFailBoundingBoxTest(docxy); } - void setSpec(const GeoLocationSpec& other); private: vespalib::geo::ZCurve::BoundingBox _zBoundingBox; }; -- cgit v1.2.3