Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/search
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2020-06-02 22:23:59 +0300
committermpimenov <mpimenov@users.noreply.github.com>2020-06-02 23:22:17 +0300
commitb013829083a199ff81f94f94b9593d930a8fc631 (patch)
tree138a7057c8ef83a85f36d7e5750fbe64aba285d5 /search
parent8ef7c2f7675e73d99a3683a0c1ee23f0b97abbaf (diff)
Review fixes.
Diffstat (limited to 'search')
-rw-r--r--search/ranking_info.cpp25
-rw-r--r--search/ranking_info.hpp12
2 files changed, 17 insertions, 20 deletions
diff --git a/search/ranking_info.cpp b/search/ranking_info.cpp
index a100398504..bf3c7a762f 100644
--- a/search/ranking_info.cpp
+++ b/search/ranking_info.cpp
@@ -118,7 +118,7 @@ void PrintParse(ostringstream & oss, array<TokenRange, Model::TYPE_COUNT> const
class IsServiceTypeChecker
{
-public:
+private:
IsServiceTypeChecker()
{
vector<string> const oneLevelTypes = {
@@ -127,29 +127,27 @@ public:
"traffic_calming"
};
- vector<vector<string>> const twoLevelTypes = {};
-
for (auto const t : oneLevelTypes)
m_oneLevelTypes.push_back(classif().GetTypeByPath({t}));
- for (auto const t : twoLevelTypes)
- m_twoLevelTypes.push_back(classif().GetTypeByPath(t));
}
- bool operator()(feature::TypesHolder const & th) const
+public:
+ static IsServiceTypeChecker const & Instance()
{
- auto findType = [](vector<uint32_t> const & v, uint32_t t, uint8_t level) {
- ftype::TruncValue(t, level);
- return find(v.begin(), v.end(), t) != v.end();
- };
+ static const IsServiceTypeChecker instance;
+ return instance;
+ }
+ bool operator()(feature::TypesHolder const & th) const
+ {
return base::AnyOf(th, [&](auto t) {
- return findType(m_oneLevelTypes, t, 1) || findType(m_twoLevelTypes, t, 2);
+ ftype::TruncValue(t, 1);
+ return find(m_oneLevelTypes.begin(), m_oneLevelTypes.end(), t) != m_oneLevelTypes.end();
});
}
private:
vector<uint32_t> m_oneLevelTypes;
- vector<uint32_t> m_twoLevelTypes;
};
} // namespace
@@ -315,8 +313,7 @@ ResultType GetResultType(feature::TypesHolder const & th)
if (base::AnyOf(attractionTypes, [&th](auto t) { return th.Has(t); }))
return ResultType::Attraction;
- static const IsServiceTypeChecker isServiceTypeChecker;
- if (isServiceTypeChecker(th))
+ if (IsServiceTypeChecker::Instance()(th))
return ResultType::Service;
return ResultType::General;
diff --git a/search/ranking_info.hpp b/search/ranking_info.hpp
index ae0b76e73d..6d4a922b13 100644
--- a/search/ranking_info.hpp
+++ b/search/ranking_info.hpp
@@ -19,19 +19,19 @@ namespace search
{
enum class ResultType : uint8_t
{
- // Railway/subway stations, airports
+ // Railway/subway stations, airports.
TransportMajor,
- // Bus/tram stops
+ // Bus/tram stops.
TransportLocal,
- // Cafes, restaurants, bars
+ // Cafes, restaurants, bars.
Eat,
- // Hotels
+ // Hotels.
Hotel,
- // Attractions
+ // Attractions.
Attraction,
// Service types: power lines and substations, barrier-fence, etc.
Service,
- // All other POIs
+ // All other POIs.
General,
Count
};