MCPcopy Create free account
hub / github.com/comaps/comaps / InitParams

Method InitParams

libs/search/processor.cpp:797–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797void Processor::InitParams(QueryParams & params) const
798{
799 /// @todo Prettify
800 params.Init(m_query.m_query, m_query.m_tokens.begin(), m_query.m_tokens.end(), m_query.m_prefix);
801
802 Classificator const & c = classif();
803
804 // Add names of categories (and synonyms).
805 QuerySliceOnRawStrings const tokenSlice(m_query.m_tokens, m_query.m_prefix);
806 params.SetCategorialRequest(m_isCategorialRequest);
807 if (m_isCategorialRequest)
808 {
809 for (auto const type : m_preferredTypes)
810 {
811 uint32_t const index = c.GetIndexForType(type);
812 for (size_t i = 0; i < tokenSlice.Size(); ++i)
813 params.GetTypeIndices(i).push_back(index);
814 }
815 }
816 else
817 {
818 ForEachCategoryTypeFuzzy(tokenSlice, [&c, &params](size_t i, uint32_t t)
819 {
820 if (!ftypes::IsNationalCuisineChecker::Instance()(t)) {
821 uint32_t const index = c.GetIndexForType(t);
822 params.GetTypeIndices(i).push_back(index);
823 }
824 });
825 }
826
827 // Remove all type indices for streets, as they're considired individually.
828 params.ClearStreetIndices();
829
830 for (size_t i = 0; i < params.GetNumTokens(); ++i)
831 base::SortUnique(params.GetTypeIndices(i));
832
833 m_keywordsScorer.ForEachLanguage([&params](int8_t lang) { params.GetLangs().insert(static_cast<uint64_t>(lang)); });
834}
835
836void Processor::InitGeocoder(Geocoder::Params & geocoderParams, SearchParams const & searchParams)
837{

Callers

nothing calls this directly

Calls 13

ForEachCategoryTypeFuzzyFunction · 0.85
SortUniqueFunction · 0.85
SetCategorialRequestMethod · 0.80
ClearStreetIndicesMethod · 0.80
ForEachLanguageMethod · 0.80
InitMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetIndexForTypeMethod · 0.45
SizeMethod · 0.45
push_backMethod · 0.45
GetNumTokensMethod · 0.45

Tested by

no test coverage detected