forked from organicmaps/organicmaps
[search] No-op rename.
This commit is contained in:
parent
1b39a479e9
commit
e21fb6cb91
4 changed files with 26 additions and 26 deletions
|
@ -76,17 +76,17 @@ size_t CategoriesHolder::LoadFromStream(istream & stream)
|
|||
while (++iter)
|
||||
{
|
||||
Category::Name name;
|
||||
name.m_Lang = langCode;
|
||||
name.m_Name = *iter;
|
||||
name.m_lang = langCode;
|
||||
name.m_name = *iter;
|
||||
|
||||
// ASSERT(name.m_Name.empty(), ());
|
||||
if (name.m_Name.empty())
|
||||
if (name.m_name.empty())
|
||||
continue;
|
||||
|
||||
if (name.m_Name[0] >= '0' && name.m_Name[0] <= '9')
|
||||
if (name.m_name[0] >= '0' && name.m_name[0] <= '9')
|
||||
{
|
||||
name.m_prefixLengthToSuggest = name.m_Name[0] - '0';
|
||||
name.m_Name = name.m_Name.substr(1);
|
||||
name.m_prefixLengthToSuggest = name.m_name[0] - '0';
|
||||
name.m_name = name.m_name.substr(1);
|
||||
}
|
||||
else
|
||||
name.m_prefixLengthToSuggest = 10;
|
||||
|
|
|
@ -16,8 +16,8 @@ struct Category
|
|||
|
||||
struct Name
|
||||
{
|
||||
string m_Name;
|
||||
int8_t m_Lang;
|
||||
string m_name;
|
||||
int8_t m_lang;
|
||||
uint8_t m_prefixLengthToSuggest;
|
||||
};
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ void Query::Search(function<void (Result const &)> const & f)
|
|||
iName != iCategory->m_synonyms.end(); ++iName)
|
||||
{
|
||||
if (m_prefix.size() >= iName->m_prefixLengthToSuggest)
|
||||
matcher.ProcessNameToken(iName->m_Name, strings::MakeUniString(iName->m_Name));
|
||||
matcher.ProcessNameToken(iName->m_name, strings::MakeUniString(iName->m_name));
|
||||
}
|
||||
|
||||
if (matcher.GetPrefixMatchScore() <= GetMaxPrefixMatchScore(m_prefix.size()) &&
|
||||
|
@ -161,7 +161,7 @@ void Query::Search(function<void (Result const &)> const & f)
|
|||
int minPrefixMatchLength = 0;
|
||||
for (vector<Category::Name>::const_iterator iName = iCategory->m_synonyms.begin();
|
||||
iName != iCategory->m_synonyms.end(); ++iName)
|
||||
if (iName->m_Name == matcher.GetBestMatchName())
|
||||
if (iName->m_name == matcher.GetBestMatchName())
|
||||
minPrefixMatchLength = iName->m_prefixLengthToSuggest;
|
||||
|
||||
AddResult(IntermediateResult(matcher.GetBestMatchName(),
|
||||
|
|
|
@ -31,19 +31,19 @@ struct Checker
|
|||
{
|
||||
TEST_EQUAL(cat.m_types.size(), 1, ());
|
||||
TEST_EQUAL(cat.m_synonyms.size(), 5, ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_Lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_Name, "bench", ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_name, "bench", ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_prefixLengthToSuggest, 1, ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_Lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_Name, "sit down", ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_name, "sit down", ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_prefixLengthToSuggest, 10, ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_Lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_Name, "to sit", ());
|
||||
TEST_EQUAL(cat.m_synonyms[3].m_Lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[3].m_Name, "bank", ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_name, "to sit", ());
|
||||
TEST_EQUAL(cat.m_synonyms[3].m_lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[3].m_name, "bank", ());
|
||||
TEST_EQUAL(cat.m_synonyms[3].m_prefixLengthToSuggest, 0, ());
|
||||
TEST_EQUAL(cat.m_synonyms[4].m_Lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[4].m_Name, "auf die strafbank schicken", ());
|
||||
TEST_EQUAL(cat.m_synonyms[4].m_lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[4].m_name, "auf die strafbank schicken", ());
|
||||
++m_count;
|
||||
}
|
||||
break;
|
||||
|
@ -51,13 +51,13 @@ struct Checker
|
|||
{
|
||||
TEST_EQUAL(cat.m_types.size(), 2, ());
|
||||
TEST_EQUAL(cat.m_synonyms.size(), 3, ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_Lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_Name, "village", ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_Lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_Name, "dorf", ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_lang, StringUtf8Multilang::GetLangIndex("en"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[0].m_name, "village", ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_name, "dorf", ());
|
||||
TEST_EQUAL(cat.m_synonyms[1].m_prefixLengthToSuggest, 2, ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_Lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_Name, "weiler", ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_lang, StringUtf8Multilang::GetLangIndex("de"), ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_name, "weiler", ());
|
||||
TEST_EQUAL(cat.m_synonyms[2].m_prefixLengthToSuggest, 4, ());
|
||||
++m_count;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue