From 4ee2f308520d650ab77dd2eb3067f07f50c75ee8 Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Fri, 30 Dec 2016 15:49:23 +0300 Subject: [PATCH] [search] Allow empty strings in search. --- search/engine.cpp | 6 +++++- search/processor.cpp | 1 - search/search_integration_tests/processor_test.cpp | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/search/engine.cpp b/search/engine.cpp index 484271acc8..fba1faf0a3 100644 --- a/search/engine.cpp +++ b/search/engine.cpp @@ -242,7 +242,11 @@ void Engine::DoSearch(SearchParams const & params, m2::RectD const & viewport, { Results results; results.SetEndMarker(true /* isCancelled */); - params.m_onResults(results); + + if (params.m_onResults) + params.m_onResults(results); + else + LOG(LERROR, ("OnResults is not set.")); return; } diff --git a/search/processor.cpp b/search/processor.cpp index 80ce3d1fc4..c551b02285 100644 --- a/search/processor.cpp +++ b/search/processor.cpp @@ -409,7 +409,6 @@ void Processor::Search(SearchParams const & params, m2::RectD const & viewport) SetInputLocale(params.m_inputLocale); - ASSERT(!params.m_query.empty(), ()); SetQuery(params.m_query); SetViewport(viewport, true /* forceUpdate */); SetOnResults(params.m_onResults); diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index 15576e14f8..b7e0be0ef1 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -172,6 +172,10 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) }); SetViewport(m2::RectD(m2::PointD(-1.0, -1.0), m2::PointD(1.0, 1.0))); + { + TRules rules = {}; + TEST(ResultsMatch("", rules), ()); + } { TRules rules = {ExactMatch(wonderlandId, busStop)}; TEST(ResultsMatch("Bus stop", rules), ());