From 7cd3e9e5fe654710ad3fd7549e2710318e527abf Mon Sep 17 00:00:00 2001 From: tatiana-yan Date: Wed, 28 Nov 2018 14:08:54 +0300 Subject: [PATCH] [indexer][generator] Do not parse special metadata types from OSM. fixup --- generator/osm2meta.cpp | 30 ------------------------------ generator/osm2meta.hpp | 11 +++++------ indexer/feature_meta.cpp | 6 ------ indexer/feature_meta.hpp | 2 +- 4 files changed, 6 insertions(+), 43 deletions(-) diff --git a/generator/osm2meta.cpp b/generator/osm2meta.cpp index 4bd7997027..10283376d1 100644 --- a/generator/osm2meta.cpp +++ b/generator/osm2meta.cpp @@ -88,18 +88,6 @@ string MetadataTagProcessorImpl::ValidateAndFormat_stars(string const & v) const return string(1, v[0]); } -string MetadataTagProcessorImpl::ValidateAndFormat_price_rate(string const & v) const -{ - if (v.size() != 1) - return string(); - - // Price rate is a single digit from 0 to 5. - if (v[0] < '0' || v[0] > '5') - return string(); - - return v; -} - string MetadataTagProcessorImpl::ValidateAndFormat_operator(string const & v) const { auto const & isATM = ftypes::IsATMChecker::Instance(); @@ -207,24 +195,6 @@ string MetadataTagProcessorImpl::ValidateAndFormat_level(string v) const return {}; } -string MetadataTagProcessorImpl::ValidateAndFormat_sponsored_id(string const & v) const -{ - uint64_t id; - if (!strings::to_uint64(v, id)) - return string(); - return v; -} - -string MetadataTagProcessorImpl::ValidateAndFormat_rating(string const & v) const -{ - double rating; - if (!strings::to_double(v, rating)) - return string(); - if (rating > 0 && rating <= 10) - return strings::to_string_dac(rating, 1); - return string(); -} - string MetadataTagProcessorImpl::ValidateAndFormat_denomination(string const & v) const { return v; diff --git a/generator/osm2meta.hpp b/generator/osm2meta.hpp index fd3b88abc1..bca47b0fbc 100644 --- a/generator/osm2meta.hpp +++ b/generator/osm2meta.hpp @@ -33,9 +33,6 @@ struct MetadataTagProcessorImpl std::string ValidateAndFormat_level(std::string v) const; std::string ValidateAndFormat_denomination(std::string const & v) const; std::string ValidateAndFormat_wikipedia(std::string v) const; - std::string ValidateAndFormat_price_rate(std::string const & v) const; - std::string ValidateAndFormat_sponsored_id(std::string const & v) const; - std::string ValidateAndFormat_rating(std::string const & v) const; std::string ValidateAndFormat_airport_iata(std::string const & v) const; protected: @@ -95,12 +92,14 @@ public: case Metadata::FMD_HEIGHT: valid = ValidateAndFormat_height(v); break; case Metadata::FMD_DENOMINATION: valid = ValidateAndFormat_denomination(v); break; case Metadata::FMD_BUILDING_LEVELS: valid = ValidateAndFormat_building_levels(v); break; - case Metadata::FMD_SPONSORED_ID: valid = ValidateAndFormat_sponsored_id(v); break; - case Metadata::FMD_PRICE_RATE: valid = ValidateAndFormat_price_rate(v); break; - case Metadata::FMD_RATING: valid = ValidateAndFormat_rating(v); break; + // Parse banner_url tag added by TagsMixer. case Metadata::FMD_BANNER_URL: valid = ValidateAndFormat_url(v); break; case Metadata::FMD_LEVEL: valid = ValidateAndFormat_level(v); break; case Metadata::FMD_AIRPORT_IATA: valid = ValidateAndFormat_airport_iata(v); break; + // Metadata types we do not get from OSM. + case Metadata::FMD_SPONSORED_ID: + case Metadata::FMD_PRICE_RATE: + case Metadata::FMD_RATING: case Metadata::FMD_TEST_ID: case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type.")); } diff --git a/indexer/feature_meta.cpp b/indexer/feature_meta.cpp index 626978bdb8..d7f6339ce9 100644 --- a/indexer/feature_meta.cpp +++ b/indexer/feature_meta.cpp @@ -86,12 +86,6 @@ bool Metadata::TypeFromString(string const & k, Metadata::EType & outType) outType = Metadata::FMD_BUILDING_LEVELS; else if (k == "denomination") outType = Metadata::FMD_DENOMINATION; - else if (k == "ref:sponsored") - outType = Metadata::FMD_SPONSORED_ID; - else if (k == "price_rate") - outType = Metadata::FMD_PRICE_RATE; - else if (k == "rating:sponsored") - outType = Metadata::FMD_RATING; else if (k == "banner_url") outType = Metadata::FMD_BANNER_URL; else if (k == "level") diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index a06536d31a..40df6a3caa 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -96,7 +96,7 @@ class Metadata : public MetadataBase public: /// @note! Do not change values here. /// Add new types to the end of list, before FMD_COUNT. - /// Please also modify MetadataTagProcessor::TypeFromString(). + /// For types parsed from OSM get corresponding OSM tag to MetadataTagProcessor::TypeFromString(). enum EType : int8_t { FMD_CUISINE = 1,