forked from organicmaps/organicmaps
Review fixes.
This commit is contained in:
parent
618b8f8c5c
commit
c399ed4679
9 changed files with 18 additions and 22 deletions
|
@ -1256,7 +1256,7 @@ void Framework::InitSearchEngine()
|
|||
params.m_numThreads = 1;
|
||||
m_searchEngine.reset(new search::Engine(const_cast<Index &>(m_model.GetIndex()),
|
||||
GetDefaultCategories(), *m_infoGetter,
|
||||
make_unique<search::SearchProcessorFactory>(), params));
|
||||
make_unique<search::ProcessorFactory>(), params));
|
||||
}
|
||||
catch (RootException const & e)
|
||||
{
|
||||
|
|
|
@ -12,14 +12,14 @@ class CountryInfoGetter;
|
|||
|
||||
namespace search
|
||||
{
|
||||
class SearchProcessorFactory
|
||||
class ProcessorFactory
|
||||
{
|
||||
public:
|
||||
virtual ~SearchProcessorFactory() = default;
|
||||
virtual ~ProcessorFactory() = default;
|
||||
|
||||
virtual unique_ptr<Processor> BuildProcessor(Index & index, CategoriesHolder const & categories,
|
||||
vector<Suggest> const & suggests,
|
||||
storage::CountryInfoGetter const & infoGetter)
|
||||
virtual unique_ptr<Processor> Build(Index & index, CategoriesHolder const & categories,
|
||||
vector<Suggest> const & suggests,
|
||||
storage::CountryInfoGetter const & infoGetter)
|
||||
{
|
||||
return make_unique<v2::ProcessorV2>(index, categories, suggests, infoGetter);
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ Engine::Params::Params(string const & locale, size_t numThreads)
|
|||
|
||||
// Engine ------------------------------------------------------------------------------------------
|
||||
Engine::Engine(Index & index, CategoriesHolder const & categories,
|
||||
storage::CountryInfoGetter const & infoGetter,
|
||||
unique_ptr<SearchProcessorFactory> factory, Params const & params)
|
||||
storage::CountryInfoGetter const & infoGetter, unique_ptr<ProcessorFactory> factory,
|
||||
Params const & params)
|
||||
: m_categories(categories), m_shutdown(false)
|
||||
{
|
||||
InitSuggestions doInit;
|
||||
|
@ -135,7 +135,7 @@ Engine::Engine(Index & index, CategoriesHolder const & categories,
|
|||
m_contexts.resize(params.m_numThreads);
|
||||
for (size_t i = 0; i < params.m_numThreads; ++i)
|
||||
{
|
||||
auto processor = factory->BuildProcessor(index, m_categories, m_suggests, infoGetter);
|
||||
auto processor = factory->Build(index, m_categories, m_suggests, infoGetter);
|
||||
processor->SetPreferredLocale(params.m_locale);
|
||||
m_contexts[i].m_processor = move(processor);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
// Doesn't take ownership of index. Takes ownership of categoriesR.
|
||||
Engine(Index & index, CategoriesHolder const & categories,
|
||||
storage::CountryInfoGetter const & infoGetter, unique_ptr<SearchProcessorFactory> factory,
|
||||
storage::CountryInfoGetter const & infoGetter, unique_ptr<ProcessorFactory> factory,
|
||||
Params const & params);
|
||||
~Engine();
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace search
|
|||
SearchTest::SearchTest()
|
||||
: m_platform(GetPlatform())
|
||||
, m_scopedLog(LDEBUG)
|
||||
, m_engine(make_unique<storage::CountryInfoGetterForTesting>(),
|
||||
make_unique<SearchProcessorFactory>(), Engine::Params())
|
||||
, m_engine(make_unique<storage::CountryInfoGetterForTesting>(), make_unique<ProcessorFactory>(),
|
||||
Engine::Params())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,7 @@ int main(int argc, char * argv[])
|
|||
}
|
||||
|
||||
classificator::Load();
|
||||
TestSearchEngine engine(move(infoGetter), make_unique<SearchProcessorFactory>(),
|
||||
Engine::Params{});
|
||||
TestSearchEngine engine(move(infoGetter), make_unique<ProcessorFactory>(), Engine::Params{});
|
||||
|
||||
vector<platform::LocalCountryFile> mwms;
|
||||
platform::FindAllLocalMapsAndCleanup(numeric_limits<int64_t>::max() /* the latest version */,
|
||||
|
|
|
@ -380,8 +380,7 @@ int main(int argc, char * argv[])
|
|||
Engine::Params params;
|
||||
params.m_locale = FLAGS_locale;
|
||||
params.m_numThreads = FLAGS_num_threads;
|
||||
TestSearchEngine engine(move(infoGetter), make_unique<SearchProcessorFactory>(),
|
||||
Engine::Params{});
|
||||
TestSearchEngine engine(move(infoGetter), make_unique<ProcessorFactory>(), Engine::Params{});
|
||||
|
||||
vector<platform::LocalCountryFile> mwms;
|
||||
if (!FLAGS_mwm_list_path.empty())
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace search
|
|||
namespace tests_support
|
||||
{
|
||||
TestSearchEngine::TestSearchEngine(unique_ptr<storage::CountryInfoGetter> infoGetter,
|
||||
unique_ptr<::search::SearchProcessorFactory> factory,
|
||||
unique_ptr<::search::ProcessorFactory> factory,
|
||||
Engine::Params const & params)
|
||||
: m_platform(GetPlatform())
|
||||
, m_infoGetter(move(infoGetter))
|
||||
|
@ -17,7 +17,7 @@ TestSearchEngine::TestSearchEngine(unique_ptr<storage::CountryInfoGetter> infoGe
|
|||
{
|
||||
}
|
||||
|
||||
TestSearchEngine::TestSearchEngine(unique_ptr<::search::SearchProcessorFactory> factory,
|
||||
TestSearchEngine::TestSearchEngine(unique_ptr<::search::ProcessorFactory> factory,
|
||||
Engine::Params const & params)
|
||||
: m_platform(GetPlatform())
|
||||
, m_infoGetter(storage::CountryInfoReader::CreateCountryInfoReader(m_platform))
|
||||
|
|
|
@ -27,10 +27,8 @@ class TestSearchEngine : public Index
|
|||
{
|
||||
public:
|
||||
TestSearchEngine(unique_ptr<storage::CountryInfoGetter> infoGetter,
|
||||
unique_ptr<search::SearchProcessorFactory> factory,
|
||||
Engine::Params const & params);
|
||||
TestSearchEngine(unique_ptr<::search::SearchProcessorFactory> factory,
|
||||
Engine::Params const & params);
|
||||
unique_ptr<search::ProcessorFactory> factory, Engine::Params const & params);
|
||||
TestSearchEngine(unique_ptr<::search::ProcessorFactory> factory, Engine::Params const & params);
|
||||
~TestSearchEngine() override;
|
||||
|
||||
inline void SetLocale(string const & locale) { m_engine.SetLocale(locale); }
|
||||
|
|
Loading…
Add table
Reference in a new issue