Cuisine editor filter fix #2921

Merged
root merged 2 commits from issue-285-suisine-search into master 2022-07-05 11:13:23 +00:00

View file

@ -39,12 +39,13 @@ Java_com_mapswithme_util_StringUtils_nativeFilterContainsNormalized(JNIEnv * env
{
std::string substr = jni::ToNativeString(env, jSubstr);
int const length = env->GetArrayLength(src);
auto const & cuisines = osm::Cuisines::Instance();
std::vector<std::string> filtered;
vng commented 2022-07-05 09:35:41 +00:00 (Migrated from github.com)
Review

Please, take this:
auto const & cuisines = osm::Cuisines::Instance();
out of the loop.

Please, take this: auto const & cuisines = osm::Cuisines::Instance(); out of the loop.
Review

Fixed

Fixed
filtered.reserve(length);
for (int i = 0; i < length; i++)
{
std::string str = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(src, i));
if (search::ContainsNormalized(str, substr))
if (search::ContainsNormalized(str, substr) || search::ContainsNormalized(cuisines.Translate(str), substr))
filtered.push_back(str);
}