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

Method MatchForSuggestions

libs/search/ranker.cpp:985–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985void Ranker::MatchForSuggestions(strings::UniString const & token, int8_t locale, string const & prologue)
986{
987 for (auto const & suggest : m_suggests)
988 {
989 strings::UniString const & s = suggest.m_name;
990 if (suggest.m_prefixLength <= token.size() && token != s // do not push suggestion if it already equals to token
991 && suggest.m_locale == locale // push suggestions only for needed language
992 && strings::StartsWith(s, token))
993 {
994 string const utf8Str = strings::ToUtf8(s);
995 Result r(utf8Str, prologue + utf8Str + " ");
996 HighlightResult(m_params.m_query.m_tokens, m_params.m_query.m_prefix, r);
997 m_emitter.AddResult(std::move(r));
998 }
999 }
1000}
1001
1002void Ranker::ProcessSuggestions(vector<RankerResult> const & vec) const
1003{

Callers

nothing calls this directly

Calls 5

HighlightResultFunction · 0.85
StartsWithFunction · 0.50
ToUtf8Function · 0.50
sizeMethod · 0.45
AddResultMethod · 0.45

Tested by

no test coverage detected