forked from organicmaps/organicmaps
Merge pull request #16 from vng/search
[search] Fixed logic with showing initial search results on map.
This commit is contained in:
commit
0b74600366
6 changed files with 9 additions and 20 deletions
|
@ -197,8 +197,9 @@ extern "C"
|
|||
{
|
||||
lock_guard<mutex> guard(g_resultsMutex);
|
||||
g_framework->DontLoadState();
|
||||
|
||||
Result const & result = g_results.GetResult(index);
|
||||
android::Platform::RunOnGuiThreadImpl([&result]()
|
||||
android::Platform::RunOnGuiThreadImpl([result]()
|
||||
{
|
||||
g_framework->NativeFramework()->ShowSearchResult(result);
|
||||
});
|
||||
|
@ -207,10 +208,12 @@ extern "C"
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_search_SearchEngine_nativeShowAllResults(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
lock_guard<mutex> guard(g_resultsMutex);
|
||||
g_framework->DontLoadState();
|
||||
android::Platform::RunOnGuiThreadImpl([]()
|
||||
|
||||
android::Platform::RunOnGuiThreadImpl([results=g_results]()
|
||||
{
|
||||
g_framework->NativeFramework()->ShowAllSearchResults();
|
||||
g_framework->NativeFramework()->ShowAllSearchResults(results);
|
||||
});
|
||||
}
|
||||
} // extern "C"
|
||||
|
|
|
@ -314,7 +314,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
|
|||
{
|
||||
f.StartInteractiveSearch(searchParams);
|
||||
if (searchResults.GetCount())
|
||||
f.ShowAllSearchResults();
|
||||
f.ShowAllSearchResults(searchResults);
|
||||
f.UpdateUserViewportChanged();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1373,13 +1373,10 @@ void Framework::ShowSearchResult(search::Result const & res)
|
|||
m_balloonManager.OnShowMark(mark);
|
||||
}
|
||||
|
||||
size_t Framework::ShowAllSearchResults()
|
||||
size_t Framework::ShowAllSearchResults(search::Results const & results)
|
||||
{
|
||||
using namespace search;
|
||||
|
||||
Results results;
|
||||
GetSearchEngine()->GetResults(results);
|
||||
|
||||
size_t count = results.GetCount();
|
||||
switch (count)
|
||||
{
|
||||
|
|
|
@ -342,7 +342,7 @@ public:
|
|||
void LoadSearchResultMetadata(search::Result & res) const;
|
||||
void ShowSearchResult(search::Result const & res);
|
||||
|
||||
size_t ShowAllSearchResults();
|
||||
size_t ShowAllSearchResults(search::Results const & results);
|
||||
void UpdateSearchResults(search::Results const & results);
|
||||
|
||||
void StartInteractiveSearch(search::SearchParams const & params) { m_lastSearch = params; }
|
||||
|
|
|
@ -141,12 +141,6 @@ bool Engine::Search(SearchParams const & params, m2::RectD const & viewport)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Engine::GetResults(Results & res)
|
||||
{
|
||||
threads::MutexGuard guard(m_searchMutex);
|
||||
res = m_searchResults;
|
||||
}
|
||||
|
||||
void Engine::SetViewportAsync(m2::RectD const & viewport)
|
||||
{
|
||||
// First of all - cancel previous query.
|
||||
|
@ -162,8 +156,6 @@ void Engine::SetViewportAsync(m2::RectD const & viewport)
|
|||
|
||||
void Engine::EmitResults(SearchParams const & params, Results & res)
|
||||
{
|
||||
m_searchResults = res;
|
||||
|
||||
// Basic test of our statistics engine.
|
||||
alohalytics::LogEvent("searchEmitResults",
|
||||
alohalytics::TStringMap({{params.m_query, strings::to_string(res.GetCount())}}));
|
||||
|
|
|
@ -28,7 +28,6 @@ class EngineData;
|
|||
class Engine
|
||||
{
|
||||
typedef function<void (Results const &)> SearchCallbackT;
|
||||
Results m_searchResults;
|
||||
|
||||
public:
|
||||
typedef Index IndexType;
|
||||
|
@ -43,8 +42,6 @@ public:
|
|||
void PrepareSearch(m2::RectD const & viewport);
|
||||
bool Search(SearchParams const & params, m2::RectD const & viewport);
|
||||
|
||||
void GetResults(Results & res);
|
||||
|
||||
string GetCountryFile(m2::PointD const & pt);
|
||||
string GetCountryCode(m2::PointD const & pt);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue