diff options
author | gorshenin <y.gorshenin@corp.mail.ru> | 2015-07-01 16:48:58 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:53:27 +0300 |
commit | a7bcdb5ae8b8e75c1a3806b00b19f3b80c72c5b3 (patch) | |
tree | e24caedef110b579fcedc15d29c62cc43e3f6d9c /search | |
parent | e0470160313b3ed0bc396ffec72b16fded6b8520 (diff) |
Revert "[storage, framework, index] Storage redesign. Plain strings are replaced to CountryFile and LocalCountryFile."
Diffstat (limited to 'search')
-rw-r--r-- | search/search_query.cpp | 23 | ||||
-rw-r--r-- | search/search_tests/house_detector_tests.cpp | 14 | ||||
-rw-r--r-- | search/search_tests/locality_finder_test.cpp | 7 |
3 files changed, 17 insertions, 27 deletions
diff --git a/search/search_query.cpp b/search/search_query.cpp index 12741b473b..0a5eab18d3 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->GetCountryFileName(); + country = m_pFV->GetFileName(); } public: @@ -1659,14 +1659,11 @@ void Query::SearchAddress(Results & res) { MwmSet::MwmId id(info); Index::MwmLock const mwmLock(const_cast<Index &>(*m_pIndex), id); + string fileName; if (mwmLock.IsLocked()) - { - platform::CountryFile const & countryFile = - mwmLock.GetValue<MwmValue>()->GetCountryFile(); - string const countryFileName = countryFile.GetNameWithoutExt(); - if (m_pInfoGetter->IsBelongToRegion(countryFileName, region.m_ids)) - SearchInMWM(mwmLock, params); - } + fileName = mwmLock.GetValue<MwmValue>()->GetFileName(); + if (m_pInfoGetter->IsBelongToRegion(fileName, region.m_ids)) + SearchInMWM(mwmLock, params); } } } @@ -2111,8 +2108,9 @@ void Query::SearchInMWM(Index::MwmLock const & mwmLock, Params const & params, TrieRootPrefix(*pLangRoot, edge), filter, categoriesHolder, emitter); - LOG(LDEBUG, ("Country", pMwm->GetCountryFile().GetNameWithoutExt(), "Lang", - StringUtf8Multilang::GetLangByCode(lang), "Matched", emitter.GetCount())); + LOG(LDEBUG, ("Country", pMwm->GetFileName(), + "Lang", StringUtf8Multilang::GetLangByCode(lang), + "Matched", emitter.GetCount())); emitter.Reset(); } @@ -2195,11 +2193,8 @@ 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>()->GetCountryFile().GetNameWithoutExt() == fileName) - { + if (mwmLock.IsLocked() && mwmLock.GetValue<MwmValue>()->GetFileName() == 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 eae291fb9a..1f03cb824d 100644 --- a/search/search_tests/house_detector_tests.cpp +++ b/search/search_tests/house_detector_tests.cpp @@ -17,7 +17,6 @@ #include "std/iostream.hpp" #include "std/fstream.hpp" -using platform::LocalCountryFile; class StreetIDsByName { @@ -184,8 +183,7 @@ UNIT_TEST(HS_StreetsMerge) classificator::Load(); Index index; - pair<MwmSet::MwmLock, bool> const p = - index.Register(LocalCountryFile::MakeForTesting("minsk-pass")); + pair<MwmSet::MwmLock, bool> const p = index.Register("minsk-pass.mwm"); TEST(p.first.IsLocked(), ()); TEST(p.second, ()); @@ -274,8 +272,7 @@ UNIT_TEST(HS_FindHouseSmoke) classificator::Load(); Index index; - pair<MwmSet::MwmLock, bool> const p = - index.Register(LocalCountryFile::MakeForTesting("minsk-pass")); + pair<MwmSet::MwmLock, bool> const p = index.Register("minsk-pass.mwm"); TEST(p.first.IsLocked(), ()); TEST(p.second, ()); @@ -348,7 +345,10 @@ 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(LocalCountryFile::MakeForTesting(country)); + pair<MwmSet::MwmLock, bool> const p = index.Register(country + ".mwm"); 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 62efda0f5e..30182f7267 100644 --- a/search/search_tests/locality_finder_test.cpp +++ b/search/search_tests/locality_finder_test.cpp @@ -5,10 +5,6 @@ #include "search/locality_finder.hpp" -#include "platform/country_file.hpp" -#include "platform/local_country_file.hpp" -#include "platform/platform.hpp" - namespace { @@ -38,8 +34,7 @@ void doTests2(search::LocalityFinder & finder, vector<m2::PointD> const & input, UNIT_TEST(LocalityFinder) { Index index; - pair<MwmSet::MwmLock, bool> const p = - index.Register(platform::LocalCountryFile::MakeForTesting("World")); + pair<MwmSet::MwmLock, bool> const p = index.Register("World.mwm"); TEST(p.second, ()); MwmSet::MwmLock const & lock = p.first; TEST(lock.IsLocked(), ()); |