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:
authorYuri Gorshenin <y@maps.me>2015-07-01 16:55:50 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:53:33 +0300
commit54e5990c7e4c65b0749c21ce4fe3866909a29668 (patch)
treeec9f80550c7402b7d5f577773353c0d7eb6fb0a7 /search
parent025f73ad85d489c4ea143b9d95dde4d308daf89b (diff)
Revert "Merge pull request #1068 from maps/revert-929-abstract-country-file"
This reverts commit 66aac38c3004d261ee06a16f7e9db372f67614df, reversing changes made to ad8708944070f6b32a17fbb944d3c493b3fb2a24.
Diffstat (limited to 'search')
-rw-r--r--search/search_query.cpp23
-rw-r--r--search/search_tests/house_detector_tests.cpp14
-rw-r--r--search/search_tests/locality_finder_test.cpp7
3 files changed, 27 insertions, 17 deletions
diff --git a/search/search_query.cpp b/search/search_query.cpp
index 0a5eab18d3..12741b473b 100644
--- a/search/search_query.cpp
+++ b/search/search_query.cpp
@@ -600,7 +600,7 @@ namespace impl
if (m_pFV->IsWorld())
country.clear();
else
- country = m_pFV->GetFileName();
+ country = m_pFV->GetCountryFileName();
}
public:
@@ -1659,11 +1659,14 @@ void Query::SearchAddress(Results & res)
{
MwmSet::MwmId id(info);
Index::MwmLock const mwmLock(const_cast<Index &>(*m_pIndex), id);
- string fileName;
if (mwmLock.IsLocked())
- fileName = mwmLock.GetValue<MwmValue>()->GetFileName();
- if (m_pInfoGetter->IsBelongToRegion(fileName, region.m_ids))
- SearchInMWM(mwmLock, params);
+ {
+ platform::CountryFile const & countryFile =
+ mwmLock.GetValue<MwmValue>()->GetCountryFile();
+ string const countryFileName = countryFile.GetNameWithoutExt();
+ if (m_pInfoGetter->IsBelongToRegion(countryFileName, region.m_ids))
+ SearchInMWM(mwmLock, params);
+ }
}
}
}
@@ -2108,9 +2111,8 @@ void Query::SearchInMWM(Index::MwmLock const & mwmLock, Params const & params,
TrieRootPrefix(*pLangRoot, edge),
filter, categoriesHolder, emitter);
- LOG(LDEBUG, ("Country", pMwm->GetFileName(),
- "Lang", StringUtf8Multilang::GetLangByCode(lang),
- "Matched", emitter.GetCount()));
+ LOG(LDEBUG, ("Country", pMwm->GetCountryFile().GetNameWithoutExt(), "Lang",
+ StringUtf8Multilang::GetLangByCode(lang), "Matched", emitter.GetCount()));
emitter.Reset();
}
@@ -2193,8 +2195,11 @@ void Query::SearchAdditional(Results & res, size_t resCount)
for (shared_ptr<MwmInfo> const & info : mwmsInfo)
{
Index::MwmLock const mwmLock(const_cast<Index &>(*m_pIndex), MwmSet::MwmId(info));
- if (mwmLock.IsLocked() && mwmLock.GetValue<MwmValue>()->GetFileName() == fileName)
+ if (mwmLock.IsLocked() &&
+ mwmLock.GetValue<MwmValue>()->GetCountryFile().GetNameWithoutExt() == fileName)
+ {
SearchInMWM(mwmLock, params);
+ }
}
FlushResults(res, true, resCount);
diff --git a/search/search_tests/house_detector_tests.cpp b/search/search_tests/house_detector_tests.cpp
index 1f03cb824d..eae291fb9a 100644
--- a/search/search_tests/house_detector_tests.cpp
+++ b/search/search_tests/house_detector_tests.cpp
@@ -17,6 +17,7 @@
#include "std/iostream.hpp"
#include "std/fstream.hpp"
+using platform::LocalCountryFile;
class StreetIDsByName
{
@@ -183,7 +184,8 @@ UNIT_TEST(HS_StreetsMerge)
classificator::Load();
Index index;
- pair<MwmSet::MwmLock, bool> const p = index.Register("minsk-pass.mwm");
+ pair<MwmSet::MwmLock, bool> const p =
+ index.Register(LocalCountryFile::MakeForTesting("minsk-pass"));
TEST(p.first.IsLocked(), ());
TEST(p.second, ());
@@ -272,7 +274,8 @@ UNIT_TEST(HS_FindHouseSmoke)
classificator::Load();
Index index;
- pair<MwmSet::MwmLock, bool> const p = index.Register("minsk-pass.mwm");
+ pair<MwmSet::MwmLock, bool> const p =
+ index.Register(LocalCountryFile::MakeForTesting("minsk-pass"));
TEST(p.first.IsLocked(), ());
TEST(p.second, ());
@@ -345,10 +348,7 @@ struct Address
string m_house;
double m_lat, m_lon;
- bool operator<(Address const & rhs) const
- {
- return (m_streetKey < rhs.m_streetKey);
- }
+ bool operator<(Address const & rhs) const { return (m_streetKey < rhs.m_streetKey); }
};
void swap(Address & a1, Address & a2)
@@ -375,7 +375,7 @@ UNIT_TEST(HS_MWMSearch)
}
Index index;
- pair<MwmSet::MwmLock, bool> const p = index.Register(country + ".mwm");
+ pair<MwmSet::MwmLock, bool> const p = index.Register(LocalCountryFile::MakeForTesting(country));
if (!p.second)
{
LOG(LWARNING, ("MWM file not found"));
diff --git a/search/search_tests/locality_finder_test.cpp b/search/search_tests/locality_finder_test.cpp
index 30182f7267..62efda0f5e 100644
--- a/search/search_tests/locality_finder_test.cpp
+++ b/search/search_tests/locality_finder_test.cpp
@@ -5,6 +5,10 @@
#include "search/locality_finder.hpp"
+#include "platform/country_file.hpp"
+#include "platform/local_country_file.hpp"
+#include "platform/platform.hpp"
+
namespace
{
@@ -34,7 +38,8 @@ void doTests2(search::LocalityFinder & finder, vector<m2::PointD> const & input,
UNIT_TEST(LocalityFinder)
{
Index index;
- pair<MwmSet::MwmLock, bool> const p = index.Register("World.mwm");
+ pair<MwmSet::MwmLock, bool> const p =
+ index.Register(platform::LocalCountryFile::MakeForTesting("World"));
TEST(p.second, ());
MwmSet::MwmLock const & lock = p.first;
TEST(lock.IsLocked(), ());