[generator] Add "kind" field in jsonl to improve rank in forward geocoder
This commit is contained in:
parent
e8c8e74f7d
commit
48b23eed46
4 changed files with 31 additions and 1 deletions
|
@ -64,6 +64,7 @@ base::JSONPtr AddAddress(std::string const & street, std::string const & house,
|
|||
localizator.SetLocale("name", Localizator::EasyObjectWithTranslation(name));
|
||||
|
||||
int const kHouseOrPoiRank = 30;
|
||||
ToJSONObject(*properties, "kind", "building");
|
||||
ToJSONObject(*properties, "rank", kHouseOrPoiRank);
|
||||
|
||||
ToJSONObject(*properties, "dref", KeyValueStorage::SerializeDref(regionKeyValue.first));
|
||||
|
|
|
@ -90,7 +90,7 @@ char const * GetLabel(PlaceLevel level)
|
|||
return "country";
|
||||
case PlaceLevel::Region:
|
||||
return "region";
|
||||
case PlaceLevel:: Subregion:
|
||||
case PlaceLevel::Subregion:
|
||||
return "subregion";
|
||||
case PlaceLevel::Locality:
|
||||
return "locality";
|
||||
|
|
|
@ -114,6 +114,7 @@ private:
|
|||
}
|
||||
|
||||
localizator.SetLocale("name", main);
|
||||
ToJSONObject(*properties, "kind", GetPlaceKind(main));
|
||||
ToJSONObject(*properties, "rank", main.GetRank());
|
||||
|
||||
if (path.size() > 1)
|
||||
|
@ -308,6 +309,33 @@ private:
|
|||
return seq;
|
||||
}
|
||||
|
||||
char const * GetPlaceKind(LevelRegion const & region) const
|
||||
{
|
||||
auto const placeType = region.GetPlaceType();
|
||||
if (placeType != PlaceType::Unknown)
|
||||
return StringifyPlaceType(placeType);
|
||||
|
||||
switch (region.GetLevel())
|
||||
{
|
||||
case PlaceLevel::Country:
|
||||
return "country";
|
||||
case PlaceLevel::Region:
|
||||
return "state";
|
||||
case PlaceLevel::Subregion:
|
||||
return "district";
|
||||
case PlaceLevel::Locality:
|
||||
return "city";
|
||||
case PlaceLevel::Suburb:
|
||||
return "suburb";
|
||||
case PlaceLevel::Sublocality:
|
||||
return "neighbourhood";
|
||||
case PlaceLevel::Unknown:
|
||||
case PlaceLevel::Count:
|
||||
UNREACHABLE();
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
std::string m_pathRegionsTmpMwm;
|
||||
std::string m_pathOutRegionsKv;
|
||||
|
||||
|
|
|
@ -291,6 +291,7 @@ base::JSONPtr StreetsBuilder::MakeStreetValue(uint64_t regionId, JsonValue const
|
|||
|
||||
localizator.SetLocale("street", localizee, "address");
|
||||
|
||||
ToJSONObject(*properties, "kind", "street");
|
||||
ToJSONObject(*properties, "dref", KeyValueStorage::SerializeDref(regionId));
|
||||
ToJSONObject(*streetObject, "properties", std::move(properties));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue