[indexer][generator] Do not parse special metadata types from OSM.
fixup
This commit is contained in:
parent
0f2aeef37e
commit
7cd3e9e5fe
4 changed files with 6 additions and 43 deletions
|
@ -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;
|
||||
|
|
|
@ -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."));
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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,
|
||||
|
|
Reference in a new issue