diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-07-16 12:12:31 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-07-16 12:23:08 +0000 |
commit | 1a7c5ee8f054b8838c4d15661b42600a12895bd1 (patch) | |
tree | 20d074532ed49aa3bc50e54902656b2d22909d3c /streamingvisitors | |
parent | 8252b6237053b344c07f082eed9422371ae0d0f2 (diff) |
remove fef::Location, use common::GeoLocationSpec instead
Diffstat (limited to 'streamingvisitors')
-rw-r--r-- | streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp | 26 | ||||
-rw-r--r-- | streamingvisitors/src/vespa/searchvisitor/queryenvironment.h | 10 |
2 files changed, 17 insertions, 19 deletions
diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp index 6096a2faea4..06bdb9f69bb 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.cpp @@ -9,6 +9,8 @@ LOG_SETUP(".searchvisitor.queryenvironment"); using search::IAttributeManager; +using search::common::GeoLocationParser; +using search::common::GeoLocationSpec; using search::fef::Properties; using vespalib::string; @@ -16,28 +18,24 @@ namespace streaming { namespace { -search::fef::Location +std::vector<GeoLocationSpec> parseLocation(const string & location_str) { - search::fef::Location fefLocation; + std::vector<GeoLocationSpec> fefLocations; if (location_str.empty()) { - return fefLocation; + return fefLocations; } - search::common::GeoLocationParser locationParser; + GeoLocationParser locationParser; if (!locationParser.parseOldFormatWithField(location_str)) { LOG(warning, "Location parse error (location: '%s'): %s. Location ignored.", location_str.c_str(), locationParser.getParseError()); - return fefLocation; + return fefLocations; } - auto location = locationParser.getGeoLocation(); - if (location.has_point) { - fefLocation.setAttribute(locationParser.getFieldName()); - fefLocation.setXPosition(location.point.x); - fefLocation.setYPosition(location.point.y); - fefLocation.setXAspect(location.x_aspect.multiplier); - fefLocation.setValid(true); + auto loc = locationParser.getGeoLocation(); + if (loc.has_point) { + fefLocations.push_back(GeoLocationSpec{locationParser.getFieldName(), loc}); } - return fefLocation; + return fefLocations; } } @@ -50,7 +48,7 @@ QueryEnvironment::QueryEnvironment(const string & location_str, _properties(properties), _attrCtx(attrMgr->createContext()), _queryTerms(), - _location(parseLocation(location_str)) + _locations(parseLocation(location_str)) { } diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h index e3da5a44167..2c08ca34aee 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h @@ -23,7 +23,7 @@ private: const search::fef::Properties &_properties; search::attribute::IAttributeContext::UP _attrCtx; std::vector<const search::fef::ITermData *> _queryTerms; - search::fef::Location _location; + std::vector<search::common::GeoLocationSpec> _locations; public: typedef std::unique_ptr<QueryEnvironment> UP; @@ -49,10 +49,10 @@ public: } // inherit documentation - std::vector<const search::fef::Location *> getAllLocations() const override { - std::vector<const search::fef::Location *> retval; - if (_location.isValid()) { - retval.push_back(&_location); + GeoLocationSpecPtrs getAllLocations() const override { + GeoLocationSpecPtrs retval; + for (const auto & loc : _locations) { + retval.push_back(&loc); } return retval; } |