diff --git a/libs/indexer/feature_utils.cpp b/libs/indexer/feature_utils.cpp index 29ba1f858..e025ae49e 100644 --- a/libs/indexer/feature_utils.cpp +++ b/libs/indexer/feature_utils.cpp @@ -4,6 +4,7 @@ #include "indexer/feature_data.hpp" #include "indexer/feature_visibility.hpp" #include "indexer/ftypes_matcher.hpp" +#include "indexer/ftypes_subtypes.hpp" #include "indexer/scales.hpp" #include "platform/distance.hpp" @@ -440,6 +441,17 @@ vector GetDescriptionLangPriority(RegionData const & regionData) return PrioritizedLanguages(preferredLangs, DefaultLanguage(regionData, preferredLangs)); } +vector GetLocalizedSubtypes(TypesHolder const & types) +{ + auto const & classificator = classif(); + auto subtypes = ftypes::Subtypes::Instance(); + vector localizedSubtypes; + for (auto const & type : types) + if (subtypes.IsSubtype(type)) + localizedSubtypes.push_back(platform::GetLocalizedTypeName(classificator.GetReadableObjectName(type))); + return localizedSubtypes; +} + vector GetCuisines(TypesHolder const & types) { auto const & isCuisine = ftypes::IsCuisineChecker::Instance(); diff --git a/libs/indexer/feature_utils.hpp b/libs/indexer/feature_utils.hpp index a0aacc313..bb13cb8d1 100644 --- a/libs/indexer/feature_utils.hpp +++ b/libs/indexer/feature_utils.hpp @@ -149,6 +149,9 @@ bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, std::s /// - default language code; std::vector GetDescriptionLangPriority(RegionData const & regionData); +// Returns vector of subtypes localized by platform. +std::vector GetLocalizedSubtypes(TypesHolder const & types); + // Returns vector of cuisines readable names from classificator. std::vector GetCuisines(TypesHolder const & types); diff --git a/libs/search/intermediate_result.cpp b/libs/search/intermediate_result.cpp index 372c729ee..315648a7e 100644 --- a/libs/search/intermediate_result.cpp +++ b/libs/search/intermediate_result.cpp @@ -279,7 +279,8 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d } } - feature::TypesHolder const typesHolder(ft); + feature::TypesHolder typesHolder(ft); + typesHolder.SortBySpec(); std::string stars; uint8_t starsCount = 0; @@ -287,6 +288,8 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d if (isHotel && strings::to_uint(ft.GetMetadata(feature::Metadata::FMD_STARS), starsCount)) stars = feature::FormatStars(starsCount); + auto const subtypes = strings::JoinStrings(feature::GetLocalizedSubtypes(typesHolder), feature::kFieldsSeparator); + auto const cuisines = feature::GetLocalizedCuisines(typesHolder); auto const cuisine = strings::JoinStrings(cuisines, feature::kFieldsSeparator); @@ -314,6 +317,7 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d append(brand); append(elevation); append(cuisine); + append(subtypes); append(fee); details.m_description = std::move(description);