More clear SearchAPI initialization logic.

Signed-off-by: vng <viktor.govako@gmail.com>
This commit is contained in:
vng 2021-03-21 13:09:14 +03:00 committed by Viktor Govako
parent 37f7a3abac
commit 8bbeed4385
3 changed files with 12 additions and 6 deletions

View file

@ -486,9 +486,8 @@ Framework::Framework(FrameworkParams const & params)
RegisterAllMaps();
LOG(LDEBUG, ("Maps initialized"));
// Need to reload cities boundaries because maps in indexer were updated.
GetSearchAPI().LoadCitiesBoundaries();
GetSearchAPI().CacheWorldLocalities();
// Perform real initialization after World was loaded.
GetSearchAPI().InitAfterWorldLoaded();
m_routingManager.SetRouterImpl(RouterType::Vehicle);

View file

@ -101,9 +101,11 @@ public:
void OnViewportChanged(m2::RectD const & viewport);
void CacheWorldLocalities() { m_engine.CacheWorldLocalities(); }
void LoadCitiesBoundaries() { m_engine.LoadCitiesBoundaries(); }
void InitAfterWorldLoaded()
{
m_engine.CacheWorldLocalities();
m_engine.LoadCitiesBoundaries();
}
// Search everywhere.
bool SearchEverywhere(search::EverywhereSearchParams const & params);

View file

@ -722,6 +722,11 @@ void Geocoder::CacheWorldLocalities()
UNUSED_VALUE(m_localitiesCaches.m_states.Get(*context));
UNUSED_VALUE(m_localitiesCaches.m_citiesTownsOrVillages.Get(*context));
}
else
{
// This is strange situation, anyway.
LOG(LWARNING, ("Can't find World map file."));
}
}
void Geocoder::FillLocalitiesTable(BaseContext const & ctx)