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
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2019-01-23 14:20:08 +0300
committermpimenov <mpimenov@users.noreply.github.com>2019-01-23 17:45:48 +0300
commita8d32b0d1eef4882be5ed1a693cbf9034197ef76 (patch)
treeef138175e436046343c90c5e4734ea9260dbd0a9 /indexer
parent019c028b1d9b60a351ba5173ae5042cbb5f4bddb (diff)
[search] Improve streets matching for HouseToStreet table.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/ftypes_matcher.cpp14
-rw-r--r--indexer/ftypes_matcher.hpp16
-rw-r--r--indexer/search_string_utils.cpp5
-rw-r--r--indexer/search_string_utils.hpp2
4 files changed, 35 insertions, 2 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index 033b4572c7..d34b2a73d2 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -200,6 +200,20 @@ IsAirportChecker::IsAirportChecker()
m_types.push_back(c.GetTypeByPath({"aeroway", "aerodrome"}));
}
+IsSquareChecker::IsSquareChecker()
+{
+ Classificator const & c = classif();
+ m_types.push_back(c.GetTypeByPath({"place", "square"}));
+}
+
+IsSuburbChecker::IsSuburbChecker()
+{
+ Classificator const & c = classif();
+ m_types.push_back(c.GetTypeByPath({"landuse", "residential"}));
+ m_types.push_back(c.GetTypeByPath({"place", "neighbourhood"}));
+ m_types.push_back(c.GetTypeByPath({"place", "suburb"}));
+}
+
IsStreetChecker::IsStreetChecker()
{
// TODO (@y, @m, @vng): this list must be up-to-date with
diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp
index 15ae1f8ee2..751d6de52f 100644
--- a/indexer/ftypes_matcher.hpp
+++ b/indexer/ftypes_matcher.hpp
@@ -104,6 +104,22 @@ public:
DECLARE_CHECKER_INSTANCE(IsAirportChecker);
};
+class IsSquareChecker : public BaseChecker
+{
+ IsSquareChecker();
+
+public:
+ DECLARE_CHECKER_INSTANCE(IsSquareChecker);
+};
+
+class IsSuburbChecker : public BaseChecker
+{
+ IsSuburbChecker();
+
+public:
+ DECLARE_CHECKER_INSTANCE(IsSuburbChecker);
+};
+
class IsStreetChecker : public BaseChecker
{
IsStreetChecker();
diff --git a/indexer/search_string_utils.cpp b/indexer/search_string_utils.cpp
index d1ff0ab62c..9bc79abd07 100644
--- a/indexer/search_string_utils.cpp
+++ b/indexer/search_string_utils.cpp
@@ -282,7 +282,7 @@ string DropLastToken(string const & str)
return string(str.begin(), iter.base());
}
-UniString GetStreetNameAsKey(string const & name)
+UniString GetStreetNameAsKey(string const & name, bool ignoreStreetSynonyms)
{
if (name.empty())
return UniString();
@@ -294,6 +294,9 @@ UniString GetStreetNameAsKey(string const & name)
UniString const s = NormalizeAndSimplifyString(*iter);
++iter;
+ if (ignoreStreetSynonyms && IsStreetSynonym(s))
+ continue;
+
res.append(s);
}
diff --git a/indexer/search_string_utils.hpp b/indexer/search_string_utils.hpp
index eb2fa303d0..45e65fab18 100644
--- a/indexer/search_string_utils.hpp
+++ b/indexer/search_string_utils.hpp
@@ -71,7 +71,7 @@ bool TokenizeStringAndCheckIfLastTokenIsPrefix(std::string const & s, Tokens & t
// Chops off the last query token (the "prefix" one) from |str|.
std::string DropLastToken(std::string const & str);
-strings::UniString GetStreetNameAsKey(std::string const & name);
+strings::UniString GetStreetNameAsKey(std::string const & name, bool ignoreStreetSynonyms);
// *NOTE* The argument string must be normalized and simplified.
bool IsStreetSynonym(strings::UniString const & s);