diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.h b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.h index 0e003facce..55af82bba7 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.h +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.h @@ -1,9 +1,9 @@ #import "MWMMapDownloaderDataSource.h" -#include "search/result.hpp" +#include "storage/downloader_search_params.hpp" @interface MWMMapDownloaderSearchDataSource : MWMMapDownloaderDataSource -- (instancetype)initWithSearchResults:(search::Results const &)results delegate:(id)delegate; +- (instancetype)initWithSearchResults:(DownloaderSearchResults const &)results delegate:(id)delegate; @end diff --git a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm index 826e6f5023..f6432f2ec9 100644 --- a/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm +++ b/iphone/Maps/Classes/MapDownloader/DataSources/MWMMapDownloaderSearchDataSource.mm @@ -17,25 +17,18 @@ extern NSString * const kPlaceCellIdentifier; @implementation MWMMapDownloaderSearchDataSource -- (instancetype)initWithSearchResults:(search::Results const &)results delegate:(id)delegate +- (instancetype)initWithSearchResults:(DownloaderSearchResults const &)results delegate:(id)delegate { self = [super initWithDelegate:delegate]; if (self) { - auto const & countryInfoGetter = GetFramework().CountryInfoGetter(); - NSMutableOrderedSet * nsSearchCountryIds = [NSMutableOrderedSet orderedSetWithCapacity:results.GetCount()]; + NSMutableOrderedSet * nsSearchCountryIds = [NSMutableOrderedSet orderedSetWithCapacity:results.m_vec.size()]; NSMutableDictionary * nsSearchResults = [@{} mutableCopy]; - for (auto it = results.Begin(); it != results.End(); ++it) + for (auto const & result : results.m_vec) { - if (!it->HasPoint()) - continue; - auto const & mercator = it->GetFeatureCenter(); - TCountryId countryId = countryInfoGetter.GetRegionCountryId(mercator); - if (countryId == kInvalidCountryId) - continue; - NSString * nsCountryId = @(countryId.c_str()); + NSString * nsCountryId = @(result.m_countryId.c_str()); [nsSearchCountryIds addObject:nsCountryId]; - nsSearchResults[nsCountryId] = @(it->GetString().c_str()); + nsSearchResults[nsCountryId] = @(result.m_matchedName.c_str()); } self.searchCountryIds = [nsSearchCountryIds array]; self.searchMatchedResults = nsSearchResults; diff --git a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm index 840052bf53..656e649b15 100644 --- a/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm +++ b/iphone/Maps/Classes/MapDownloader/MWMMapDownloaderViewController.mm @@ -7,7 +7,7 @@ #include "Framework.h" -#include "search/params.hpp" +#include "storage/downloader_search_params.hpp" using namespace storage; @@ -33,7 +33,7 @@ using namespace storage; @implementation MWMMapDownloaderViewController { - search::SearchParams m_searchParams; + DownloaderSearchParams m_searchParams; } - (void)viewDidLoad @@ -111,11 +111,10 @@ using namespace storage; if (activeInputModes.count != 0) { NSString * primaryLanguage = ((UITextInputMode *)activeInputModes[0]).primaryLanguage; - m_searchParams.SetInputLocale(primaryLanguage.UTF8String); + m_searchParams.m_inputLocale = primaryLanguage.UTF8String; } m_searchParams.m_query = searchText.precomposedStringWithCompatibilityMapping.UTF8String; - m_searchParams.SetForceSearch(true); - GetFramework().Search(m_searchParams); + GetFramework().SearchInDownloader(m_searchParams); } } @@ -131,12 +130,10 @@ using namespace storage; - (void)setupSearchParams { __weak auto weakSelf = self; - m_searchParams.SetMode(search::Mode::World); - m_searchParams.SetSuggestsEnabled(false); - m_searchParams.m_onResults = ^(search::Results const & results) + m_searchParams.m_onResults = ^(DownloaderSearchResults const & results) { __strong auto self = weakSelf; - if (!self || results.IsEndMarker()) + if (!self || results.m_endMarker) return; self.searchDataSource = [[MWMMapDownloaderSearchDataSource alloc] initWithSearchResults:results delegate:self]; dispatch_async(dispatch_get_main_queue(), ^