[booking] Provider → sponsored, added metadata fields
This commit is contained in:
parent
0359fd1c86
commit
aa361f058b
9 changed files with 70 additions and 9 deletions
|
@ -779,6 +779,9 @@ world +
|
|||
tyres -
|
||||
wine -
|
||||
{}
|
||||
sponsored +
|
||||
booking -
|
||||
{}
|
||||
sport +
|
||||
american_football -
|
||||
archery -
|
||||
|
|
|
@ -1109,12 +1109,14 @@ leisure|sports_centre|yoga;[leisure=sports_centre][sport=yoga];;name;int_name;11
|
|||
amenity|public_bookcase;1109;
|
||||
tourism|apartment;1110;
|
||||
tourism|resort;1111;
|
||||
tourism|hotel|booking;[tourism=hotel][provider=booking];;name;int_name;1112;
|
||||
tourism|motel|booking;[tourism=motel][provider=booking];;name;int_name;1113;
|
||||
tourism|hostel|booking;[tourism=hostel][provider=booking];;name;int_name;1114;
|
||||
tourism|chalet|booking;[tourism=chalet][provider=booking];;name;int_name;1115;
|
||||
tourism|guest_house|booking;[tourism=guest_house][provider=booking];;name;int_name;1116;
|
||||
tourism|alpine_hut|booking;[tourism=alpine_hut][provider=booking];;name;int_name;1117;
|
||||
tourism|camp_site|booking;[tourism=camp_site][provider=booking];;name;int_name;1118;
|
||||
tourism|apartment|booking;[tourism=apartment][provider=booking];;name;int_name;1119;
|
||||
tourism|resort|booking;[tourism=resort][provider=booking];;name;int_name;1120;
|
||||
tourism|hotel|booking;[tourism=hotel][sponsored=booking];;name;int_name;1112;
|
||||
tourism|motel|booking;[tourism=motel][sponsored=booking];;name;int_name;1113;
|
||||
tourism|hostel|booking;[tourism=hostel][sponsored=booking];;name;int_name;1114;
|
||||
tourism|chalet|booking;[tourism=chalet][sponsored=booking];;name;int_name;1115;
|
||||
tourism|guest_house|booking;[tourism=guest_house][sponsored=booking];;name;int_name;1116;
|
||||
tourism|alpine_hut|booking;[tourism=alpine_hut][sponsored=booking];;name;int_name;1117;
|
||||
tourism|camp_site|booking;[tourism=camp_site][sponsored=booking];;name;int_name;1118;
|
||||
tourism|apartment|booking;[tourism=apartment][sponsored=booking];;name;int_name;1119;
|
||||
tourism|resort|booking;[tourism=resort][sponsored=booking];;name;int_name;1120;
|
||||
sponsored;[sponsored];;name;int_name;1121;
|
||||
sponsored|booking;1122;
|
||||
|
|
|
|
@ -1118,3 +1118,5 @@ tourism|alpine_hut|booking
|
|||
tourism|camp_site|booking
|
||||
tourism|apartment|booking
|
||||
tourism|resort|booking
|
||||
sponsored
|
||||
sponsored|booking
|
||||
|
|
|
@ -779,6 +779,9 @@ world 00000000000000000000 +
|
|||
tyres 00000000000000000111 -
|
||||
wine 00000000000000000111 -
|
||||
{}
|
||||
sponsored 00000000000000000000 +
|
||||
booking 00000000000000000000 -
|
||||
{}
|
||||
sport 00000000000000000000 +
|
||||
american_football 00000000000000000111 -
|
||||
archery 00000000000000000111 -
|
||||
|
|
|
@ -85,6 +85,18 @@ 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();
|
||||
|
@ -175,6 +187,24 @@ string MetadataTagProcessorImpl::ValidateAndFormat_building_levels(string v) con
|
|||
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;
|
||||
|
|
|
@ -32,6 +32,9 @@ struct MetadataTagProcessorImpl
|
|||
string ValidateAndFormat_building_levels(string v) const;
|
||||
string ValidateAndFormat_denomination(string const & v) const;
|
||||
string ValidateAndFormat_wikipedia(string v) const;
|
||||
string ValidateAndFormat_price_rate(string const & v) const;
|
||||
string ValidateAndFormat_sponsored_id(string const & v) const;
|
||||
string ValidateAndFormat_rating(string const & v) const;
|
||||
|
||||
protected:
|
||||
FeatureParams & m_params;
|
||||
|
@ -91,6 +94,9 @@ 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;
|
||||
|
||||
case Metadata::FMD_TEST_ID:
|
||||
case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type."));
|
||||
|
|
|
@ -88,6 +88,12 @@ 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
|
||||
return false;
|
||||
|
||||
|
@ -123,6 +129,9 @@ string DebugPrint(feature::Metadata::EType type)
|
|||
case Metadata::FMD_MIN_HEIGHT: return "min_height";
|
||||
case Metadata::FMD_DENOMINATION: return "denomination";
|
||||
case Metadata::FMD_BUILDING_LEVELS: return "building:levels";
|
||||
case Metadata::FMD_SPONSORED_ID: return "ref:sponsored";
|
||||
case Metadata::FMD_PRICE_RATE: return "price_rate";
|
||||
case Metadata::FMD_RATING: return "rating:sponsored";
|
||||
case Metadata::FMD_TEST_ID: return "test_id";
|
||||
case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type."));
|
||||
};
|
||||
|
|
|
@ -123,6 +123,9 @@ public:
|
|||
FMD_DENOMINATION = 21,
|
||||
FMD_BUILDING_LEVELS = 22,
|
||||
FMD_TEST_ID = 23,
|
||||
FMD_SPONSORED_ID = 24,
|
||||
FMD_PRICE_RATE = 25,
|
||||
FMD_RATING = 26,
|
||||
FMD_COUNT
|
||||
};
|
||||
|
||||
|
|
|
@ -144,6 +144,9 @@ vector<Props> MetadataToProps(vector<T> const & metadata)
|
|||
case Metadata::FMD_HEIGHT:
|
||||
case Metadata::FMD_MIN_HEIGHT:
|
||||
case Metadata::FMD_DENOMINATION:
|
||||
case Metadata::FMD_SPONSORED_ID:
|
||||
case Metadata::FMD_PRICE_RATE:
|
||||
case Metadata::FMD_RATING:
|
||||
case Metadata::FMD_TEST_ID:
|
||||
case Metadata::FMD_COUNT:
|
||||
break;
|
||||
|
|
Reference in a new issue