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

Method ClearStreetIndices

libs/search/query_params.cpp:1545–1582  ·  view source on GitHub ↗

QueryParams -------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1543
1544// QueryParams -------------------------------------------------------------------------------------
1545void QueryParams::ClearStreetIndices()
1546{
1547 class AdditionalCommonTokens
1548 {
1549 set<String> m_strings;
1550
1551 public:
1552 AdditionalCommonTokens()
1553 {
1554 char const * arr[] = {
1555 "a", "and", "s", "the", // English
1556 "am", "an", "auf", "der", "im", "und", "zum", // German
1557 "as", "d", "da", "das", "de", "del", "di", "do", "dos", "du", "e",
1558 "el", "et", "la", "las", "le", "les", "los", "o", "os", "y", // French, Italian, Portuguese, Spanish
1559 "в", "и", "за", "к", "на", "я" // Cyrillic
1560 };
1561 for (char const * s : arr)
1562 m_strings.insert(NormalizeAndSimplifyString(s));
1563 }
1564 bool Has(String const & s) const { return m_strings.count(s) > 0; }
1565 };
1566 static AdditionalCommonTokens const s_addCommonTokens;
1567
1568 size_t const count = GetNumTokens();
1569 m_isCommonToken.resize(count, false);
1570
1571 for (size_t i = 0; i < count; ++i)
1572 {
1573 auto const & token = GetToken(i).GetOriginal();
1574 if (IsStreetSynonym(token))
1575 {
1576 m_typeIndices[i].clear();
1577 m_isCommonToken[i] = true;
1578 }
1579 else if (s_addCommonTokens.Has(token))
1580 m_isCommonToken[i] = true;
1581 }
1582}
1583
1584void QueryParams::Clear()
1585{

Callers 1

InitParamsMethod · 0.80

Calls 5

GetTokenFunction · 0.85
IsStreetSynonymFunction · 0.85
resizeMethod · 0.45
clearMethod · 0.45
HasMethod · 0.45

Tested by

no test coverage detected