diff options
author | Yuri Gorshenin <y@maps.me> | 2017-08-30 18:13:32 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2017-09-13 16:25:46 +0300 |
commit | f68d43d27735b9564d1214f1e3ac6efaaa973b6b (patch) | |
tree | 15709d8e0075d0db5503bef1ab921250f6bfc570 /search | |
parent | 56072f805f320a8455ab1d2a3d29ad7946a394d2 (diff) |
[search] OnStarted() is always called when set.
Diffstat (limited to 'search')
-rw-r--r-- | search/engine.cpp | 13 | ||||
-rw-r--r-- | search/processor.cpp | 18 |
2 files changed, 15 insertions, 16 deletions
diff --git a/search/engine.cpp b/search/engine.cpp index fba1faf0a3..9469754749 100644 --- a/search/engine.cpp +++ b/search/engine.cpp @@ -237,19 +237,6 @@ void Engine::DoSearch(SearchParams const & params, m2::RectD const & viewport, handle->Detach(); }); - // Early exit when query processing is cancelled. - if (processor.IsCancelled()) - { - Results results; - results.SetEndMarker(true /* isCancelled */); - - if (params.m_onResults) - params.m_onResults(results); - else - LOG(LERROR, ("OnResults is not set.")); - return; - } - processor.Search(params, viewport); } } // namespace search diff --git a/search/processor.cpp b/search/processor.cpp index dd26925b2e..a0e3064c1f 100644 --- a/search/processor.cpp +++ b/search/processor.cpp @@ -423,6 +423,21 @@ void Processor::ForEachCategoryTypeFuzzy(StringSliceBase const & slice, ToDo && void Processor::Search(SearchParams const & params, m2::RectD const & viewport) { + if (params.m_onStarted) + params.m_onStarted(); + + if (IsCancelled()) + { + Results results; + results.SetEndMarker(true /* isCancelled */); + + if (params.m_onResults) + params.m_onResults(results); + else + LOG(LERROR, ("OnResults is not set.")); + return; + } + SetMode(params.m_mode); bool const viewportSearch = m_mode == Mode::Viewport; @@ -464,9 +479,6 @@ void Processor::Search(SearchParams const & params, m2::RectD const & viewport) try { - if (params.m_onStarted) - params.m_onStarted(); - SearchCoordinates(); if (viewportSearch) |