Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2018-09-19 19:06:33 +0300
committerAleksey Belousov <beloal@users.noreply.github.com>2018-09-25 11:56:55 +0300
commitdbf2f9868cbd9b3fdee8948309410a56a66b1187 (patch)
tree79f8f8cdcf33cc41759aebd8a882f0468dbae764
parent57751bbf4e1bef731775a464a065b88aae712efc (diff)
[types_strings][android][search] types localization logic for search results is moved from core to android
-rw-r--r--android/jni/com/mapswithme/maps/SearchEngine.cpp4
-rw-r--r--android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java11
-rw-r--r--android/src/com/mapswithme/maps/gallery/Holders.java21
-rw-r--r--android/src/com/mapswithme/maps/search/SearchAdapter.java20
-rw-r--r--android/src/com/mapswithme/maps/search/SearchFragment.java10
-rw-r--r--android/src/com/mapswithme/util/Utils.java9
-rw-r--r--editor/editor_tests/new_feature_categories_test.cpp38
-rw-r--r--map/address_finder.cpp5
-rw-r--r--map/discovery/discovery_search.cpp5
-rw-r--r--map/framework.cpp4
-rw-r--r--map/map_tests/booking_filter_test.cpp4
-rw-r--r--qt/create_feature_dialog.cpp5
-rw-r--r--qt/editor_dialog.cpp6
-rw-r--r--qt/search_panel.cpp3
-rw-r--r--search/ranker.cpp4
-rw-r--r--search/result.cpp26
-rw-r--r--search/result.hpp10
-rw-r--r--search/search_quality/assessment_tool/result_view.cpp13
-rw-r--r--search/search_tests/results_tests.cpp7
-rwxr-xr-xtools/unix/generate_localizations.sh2
20 files changed, 118 insertions, 89 deletions
diff --git a/android/jni/com/mapswithme/maps/SearchEngine.cpp b/android/jni/com/mapswithme/maps/SearchEngine.cpp
index 48ed2a2cc1..b05c33286f 100644
--- a/android/jni/com/mapswithme/maps/SearchEngine.cpp
+++ b/android/jni/com/mapswithme/maps/SearchEngine.cpp
@@ -337,7 +337,9 @@ jobject ToJavaResult(Result & result, search::ProductInfo const & productInfo, b
jni::TScopedLocalRef featureId(env, usermark_helper::CreateFeatureId(env, isFeature ?
result.GetFeatureID() :
kEmptyFeatureId));
- jni::TScopedLocalRef featureType(env, jni::ToJavaString(env, result.GetFeatureTypeName()));
+ string readableType = isFeature ? classif().GetReadableObjectName(result.GetFeatureType()) : "";
+
+ jni::TScopedLocalRef featureType(env, jni::ToJavaString(env, readableType));
jni::TScopedLocalRef address(env, jni::ToJavaString(env, result.GetAddress()));
jni::TScopedLocalRef dist(env, jni::ToJavaString(env, distance));
jni::TScopedLocalRef cuisine(env, jni::ToJavaString(env, result.GetCuisine()));
diff --git a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java
index 28e87bcb78..ad3e7ca99f 100644
--- a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java
+++ b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java
@@ -366,10 +366,15 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove
}
@NonNull
- private static MapObject createMapObject(@NonNull Items.SearchItem item)
+ private MapObject createMapObject(@NonNull Items.SearchItem item)
{
- String title = TextUtils.isEmpty(item.getTitle()) ? "" : item.getTitle();
- String subtitle = TextUtils.isEmpty(item.getSubtitle()) ? "" : item.getSubtitle();
+ String featureType = item.getFeatureType();
+ String subtitle = TextUtils.isEmpty(featureType)
+ ? ""
+ : Utils.getLocalizedFeatureType(getContext(), featureType);
+
+ String title = TextUtils.isEmpty(item.getTitle()) ? subtitle : item.getTitle();
+
return MapObject.createMapObject(FeatureId.EMPTY, MapObject.SEARCH, title, subtitle,
item.getLat(), item.getLon());
}
diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java
index 9f4d1ccff6..ec5bc376d8 100644
--- a/android/src/com/mapswithme/maps/gallery/Holders.java
+++ b/android/src/com/mapswithme/maps/gallery/Holders.java
@@ -247,8 +247,15 @@ public class Holders
public void bind(@NonNull Items.SearchItem item)
{
super.bind(item);
- UiUtils.setTextAndHideIfEmpty(mTitle, item.getTitle());
- UiUtils.setTextAndHideIfEmpty(mSubtitle, item.getSubtitle());
+
+ String featureType = item.getFeatureType();
+ String localizedType = TextUtils.isEmpty(featureType)
+ ? ""
+ : Utils.getLocalizedFeatureType(mSubtitle.getContext(), featureType);
+ String title = TextUtils.isEmpty(item.getTitle()) ? localizedType : item.getTitle();
+
+ UiUtils.setTextAndHideIfEmpty(mTitle, title);
+ UiUtils.setTextAndHideIfEmpty(mSubtitle, localizedType);
UiUtils.setTextAndHideIfEmpty(mDistance, item.getDistance());
UiUtils.showIf(item.getPopularity().getType() == Popularity.Type.POPULAR, mPopularTagRating);
@@ -282,9 +289,15 @@ public class Holders
@Override
public void bind(@NonNull Items.SearchItem item)
{
- UiUtils.setTextAndHideIfEmpty(mTitle, item.getTitle());
+ String featureType = item.getFeatureType();
+ String localizedType = TextUtils.isEmpty(featureType)
+ ? ""
+ : Utils.getLocalizedFeatureType(mSubtitle.getContext(), featureType);
+ String title = TextUtils.isEmpty(item.getTitle()) ? localizedType : item.getTitle();
+
+ UiUtils.setTextAndHideIfEmpty(mTitle, title);
UiUtils.setTextAndHideIfEmpty(mSubtitle, formatDescription(item.getStars(),
- item.getFeatureType(),
+ localizedType,
item.getPrice(),
mSubtitle.getResources()));
diff --git a/android/src/com/mapswithme/maps/search/SearchAdapter.java b/android/src/com/mapswithme/maps/search/SearchAdapter.java
index a46338bee5..3e0889a97e 100644
--- a/android/src/com/mapswithme/maps/search/SearchAdapter.java
+++ b/android/src/com/mapswithme/maps/search/SearchAdapter.java
@@ -29,6 +29,7 @@ import com.mapswithme.maps.ugc.UGC;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
+import com.mapswithme.util.Utils;
import java.util.Arrays;
import java.util.HashSet;
@@ -84,7 +85,18 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.SearchDataViewHol
{
mResult = (SearchResult)result;
mOrder = order;
- SpannableStringBuilder builder = new SpannableStringBuilder(mResult.name);
+ TextView titleView = getTitleView();
+
+ String title = mResult.name;
+ if (TextUtils.isEmpty(title))
+ {
+ SearchResult.Description description = mResult.description;
+ title = description != null
+ ? Utils.getLocalizedFeatureType(titleView.getContext(), description.featureType)
+ : "";
+ }
+
+ SpannableStringBuilder builder = new SpannableStringBuilder(title);
if (mResult.highlightRanges != null)
{
final int size = mResult.highlightRanges.length / 2;
@@ -99,7 +111,6 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.SearchDataViewHol
}
}
- TextView titleView = getTitleView();
if (titleView != null)
titleView.setText(builder);
}
@@ -201,7 +212,10 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.SearchDataViewHol
// FIXME: Better format based on result type
private CharSequence formatDescription(SearchResult result, boolean isHotelAvailable)
{
- final SpannableStringBuilder res = new SpannableStringBuilder(result.description.featureType);
+
+ String localizedType = Utils.getLocalizedFeatureType(mFrame.getContext(),
+ result.description.featureType);
+ final SpannableStringBuilder res = new SpannableStringBuilder(localizedType);
final SpannableStringBuilder tail = new SpannableStringBuilder();
int stars = result.description.stars;
diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java
index 8a4cbbeb09..abc47368b2 100644
--- a/android/src/com/mapswithme/maps/search/SearchFragment.java
+++ b/android/src/com/mapswithme/maps/search/SearchFragment.java
@@ -539,9 +539,13 @@ public class SearchFragment extends BaseMwmFragment
if (RoutingController.get().isWaitingPoiPick())
{
SearchResult.Description description = result.description;
- final MapObject point = MapObject.createMapObject(FeatureId.EMPTY, MapObject.SEARCH, result.name,
- description != null ? description.featureType : "",
- result.lat, result.lon);
+ String subtitle = description != null
+ ? Utils.getLocalizedFeatureType(getContext(), description.featureType)
+ : "";
+ String title = TextUtils.isEmpty(result.name) ? subtitle : "";
+
+ final MapObject point = MapObject.createMapObject(FeatureId.EMPTY, MapObject.SEARCH,
+ title, subtitle, result.lat, result.lon);
RoutingController.get().onPoiSelected(point);
}
diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java
index d78c25fe1c..84d6a18c4f 100644
--- a/android/src/com/mapswithme/util/Utils.java
+++ b/android/src/com/mapswithme/util/Utils.java
@@ -712,17 +712,12 @@ public class Utils
void invoke(@NonNull T param);
}
- @StringRes
- public static int getStringIdForFeatureType(@NonNull Context context, String type)
+ public static String getLocalizedFeatureType(@NonNull Context context, @NonNull String type)
{
String key = "type." + type.replace('-', '.');
- return getStringIdByKey(context, key);
- }
- public static String getLocalizedFeatureType(@NonNull Context context, String type)
- {
@StringRes
- int id = getStringIdForFeatureType(context, type);
+ int id = getStringIdByKey(context, key);
try
{
diff --git a/editor/editor_tests/new_feature_categories_test.cpp b/editor/editor_tests/new_feature_categories_test.cpp
index 19ebad64a9..7e8020863e 100644
--- a/editor/editor_tests/new_feature_categories_test.cpp
+++ b/editor/editor_tests/new_feature_categories_test.cpp
@@ -19,49 +19,31 @@ UNIT_TEST(NewFeatureCategories_UniqueNames)
using namespace std;
classificator::Load();
- auto const & cl = classif();
editor::EditorConfig config;
osm::NewFeatureCategories categories(config);
auto const & disabled = CategoriesHolder::kDisabledLanguages;
- bool noDuplicates = true;
for (auto const & locale : CategoriesHolder::kLocaleMapping)
{
string const lang(locale.m_name);
if (find(disabled.begin(), disabled.end(), lang) != disabled.end())
continue;
categories.AddLanguage(lang);
- auto const & names = categories.GetAllCategoryNames(lang);
+ auto names = categories.GetAllCategoryNames();
- auto firstFn = bind(&pair<string, uint32_t>::first, placeholders::_1);
- set<string> uniqueNames(make_transform_iterator(names.begin(), firstFn),
- make_transform_iterator(names.end(), firstFn));
- if (uniqueNames.size() == names.size())
- continue;
-
- LOG(LWARNING, ("Invalid category translations", lang));
-
- map<string, vector<uint32_t>> typesByName;
- for (auto const & entry : names)
- typesByName[entry.first].push_back(entry.second);
+ auto result = std::unique(names.begin(), names.end());
- for (auto const & entry : typesByName)
+ if (result != names.end())
{
- if (entry.second.size() <= 1)
- continue;
- noDuplicates = false;
- ostringstream str;
- str << entry.first << ":";
- for (auto const & type : entry.second)
- str << " " << cl.GetReadableObjectName(type);
- LOG(LWARNING, (str.str()));
- }
+ LOG(LWARNING, ("Types duplication detected! The following types are duplicated:"));
+ do
+ {
+ LOG(LWARNING, (*result));
+ } while (++result != names.end());
- LOG(LWARNING,
- ("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"));
+ TEST(false, ("Please look at output above"));
+ }
};
-
- TEST(noDuplicates, ());
}
diff --git a/map/address_finder.cpp b/map/address_finder.cpp
index 57de96aa25..45cace4755 100644
--- a/map/address_finder.cpp
+++ b/map/address_finder.cpp
@@ -516,10 +516,9 @@ vector<string> Framework::GetPrintableFeatureTypes(FeatureType & ft) const
feature::TypesHolder types(ft);
types.SortBySpec();
- // Try to add types from categories.
- CategoriesHolder const & cats = GetDefaultCategories();
+ auto const & c = classif();
for (uint32_t type : types)
- results.push_back(cats.GetReadableFeatureType(type, locale));
+ results.push_back(c.GetReadableObjectName(type));
return results;
}
diff --git a/map/discovery/discovery_search.cpp b/map/discovery/discovery_search.cpp
index c8519569ba..b39409219d 100644
--- a/map/discovery/discovery_search.cpp
+++ b/map/discovery/discovery_search.cpp
@@ -25,14 +25,11 @@ search::Result MakeResultFromFeatureType(FeatureType & ft)
feature::TypesHolder holder(ft);
holder.SortBySpec();
- CategoriesHolder const & categories = GetDefaultCategories();
- auto const readableType = categories.GetReadableFeatureType(
- holder.GetBestType(), categories.MapLocaleToInteger(languages::GetCurrentOrig()));
search::Result::Metadata metadata;
search::ProcessMetadata(ft, metadata);
- return {ft.GetID(), feature::GetCenter(ft), name, "", readableType, holder.GetBestType(), metadata};
+ return {ft.GetID(), feature::GetCenter(ft), name, "", holder.GetBestType(), metadata};
}
FeatureType MakeFeatureTypeWithCachedGuard(DataSource const & dataSource, MwmSet::MwmId & mwmId,
diff --git a/map/framework.cpp b/map/framework.cpp
index 6fd46ca17d..d61a388ee7 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -2792,8 +2792,8 @@ bool Framework::ParseEditorDebugCommand(search::SearchParams const & params)
ft.GetReadableName(name);
feature::TypesHolder const types(ft);
search::Result::Metadata smd;
- results.AddResultNoChecks(search::Result(fid, feature::GetCenter(ft), name, edit.second,
- DebugPrint(types), types.GetBestType(), smd));
+ results.AddResultNoChecks(
+ search::Result(fid, feature::GetCenter(ft), name, edit.second, types.GetBestType(), smd));
}
params.m_onResults(results);
diff --git a/map/map_tests/booking_filter_test.cpp b/map/map_tests/booking_filter_test.cpp
index b995d9c5bc..1148ed840b 100644
--- a/map/map_tests/booking_filter_test.cpp
+++ b/map/map_tests/booking_filter_test.cpp
@@ -89,7 +89,7 @@ UNIT_CLASS_TEST(TestMwmEnvironment, BookingFilter_AvailabilitySmoke)
[&results, &expectedResults](FeatureType & ft) {
search::Result::Metadata metadata;
metadata.m_isSponsoredHotel = true;
- search::Result result(ft.GetID(), ft.GetCenter(), "", "", "", 0, metadata);
+ search::Result result(ft.GetID(), ft.GetCenter(), "", "", 0, metadata);
auto copy = result;
results.AddResult(std::move(result));
expectedResults.AddResult(std::move(copy));
@@ -164,7 +164,7 @@ UNIT_CLASS_TEST(TestMwmEnvironment, BookingFilter_ProcessorSmoke)
metadata.m_isSponsoredHotel = true;
std::string name;
ft.GetName(StringUtf8Multilang::kDefaultCode, name);
- search::Result result(ft.GetID(), ft.GetCenter(), name, "", "", 0, metadata);
+ search::Result result(ft.GetID(), ft.GetCenter(), name, "", 0, metadata);
InsertResult(result, results);
auto const sponsoredId = ft.GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
diff --git a/qt/create_feature_dialog.cpp b/qt/create_feature_dialog.cpp
index 630f45b89b..7244d85afc 100644
--- a/qt/create_feature_dialog.cpp
+++ b/qt/create_feature_dialog.cpp
@@ -16,11 +16,10 @@ CreateFeatureDialog::CreateFeatureDialog(QWidget * parent, osm::NewFeatureCatego
QListWidget * allSortedList = new QListWidget();
- auto const & categories = cats.GetAllCategoryNames(languages::GetCurrentNorm());
+ auto const & categories = cats.GetAllCategoryNames();
for (auto const & entry : categories)
{
- QListWidgetItem * lwi = new QListWidgetItem(entry.first.c_str() /* name */, allSortedList);
- lwi->setData(Qt::UserRole, entry.second /* type */);
+ new QListWidgetItem(entry.c_str() /* name */, allSortedList);
}
connect(allSortedList, SIGNAL(clicked(QModelIndex const &)), this,
SLOT(OnListItemSelected(QModelIndex const &)));
diff --git a/qt/editor_dialog.cpp b/qt/editor_dialog.cpp
index b4c5e448cd..905c264d9e 100644
--- a/qt/editor_dialog.cpp
+++ b/qt/editor_dialog.cpp
@@ -39,11 +39,9 @@ EditorDialog::EditorDialog(QWidget * parent, osm::EditableMapObject & emo)
{ // Feature types.
grid->addWidget(new QLabel("Type:"), row, 0);
- string localized = m_feature.GetLocalizedType();
+
string const raw = DebugPrint(m_feature.GetTypes());
- if (!strings::EqualNoCase(localized, raw))
- localized += " (" + raw + ")";
- QLabel * label = new QLabel(QString::fromStdString(localized));
+ QLabel * label = new QLabel(QString::fromStdString(raw));
label->setTextInteractionFlags(Qt::TextSelectableByMouse);
grid->addWidget(label, row++, 1);
}
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp
index 9757e9d4f7..1cd5dede6c 100644
--- a/qt/search_panel.cpp
+++ b/qt/search_panel.cpp
@@ -115,7 +115,8 @@ void SearchPanel::OnSearchResults(uint64_t timestamp, search::Results const & re
if (res.GetResultType() == search::Result::Type::Feature)
{
- m_pTable->setItem(rowCount, 0, CreateItem(QString::fromStdString(res.GetFeatureTypeName())));
+ string readableType = classif().GetReadableObjectName(res.GetFeatureType());
+ m_pTable->setItem(rowCount, 0, CreateItem(QString::fromStdString(readableType)));
m_pTable->setItem(rowCount, 3, CreateItem(m_pDrawWidget->GetDistance(res).c_str()));
}
diff --git a/search/ranker.cpp b/search/ranker.cpp
index 12dfa65e1d..d019948dc2 100644
--- a/search/ranker.cpp
+++ b/search/ranker.cpp
@@ -425,9 +425,7 @@ Result Ranker::MakeResult(RankerResult const & rankerResult, bool needAddress,
case RankerResult::Type::TYPE_BUILDING:
{
auto const type = rankerResult.GetBestType(m_params.m_preferredTypes);
- return Result(r.GetID(), r.GetCenter(), name, address,
- m_categories.GetReadableFeatureType(type, m_params.m_currentLocaleCode), type,
- r.GetMetadata());
+ return Result(r.GetID(), r.GetCenter(), name, address, type, r.GetMetadata());
}
case RankerResult::Type::TYPE_LATLON: return Result(r.GetCenter(), name, address);
}
diff --git a/search/result.cpp b/search/result.cpp
index 13689c6d0c..110ac9d381 100644
--- a/search/result.cpp
+++ b/search/result.cpp
@@ -3,6 +3,8 @@
#include "search/common.hpp"
#include "search/geometry_utils.hpp"
+#include "indexer/classificator.hpp"
+
#include "base/string_utils.hpp"
#include <sstream>
@@ -34,14 +36,12 @@ string Join(string const & s, Args &&... args)
// Result ------------------------------------------------------------------------------------------
Result::Result(FeatureID const & id, m2::PointD const & pt, string const & str,
- string const & address, string const & featureTypeName, uint32_t featureType,
- Metadata const & meta)
+ string const & address, uint32_t featureType, Metadata const & meta)
: m_resultType(Type::Feature)
, m_id(id)
, m_center(pt)
- , m_str(str.empty() ? featureTypeName : str)
+ , m_str(str)
, m_address(address)
- , m_featureTypeName(featureTypeName)
, m_featureType(featureType)
, m_metadata(meta)
{
@@ -62,7 +62,6 @@ Result::Result(Result const & res, string const & suggest)
, m_center(res.m_center)
, m_str(res.m_str)
, m_address(res.m_address)
- , m_featureTypeName(res.m_featureTypeName)
, m_featureType(res.m_featureType)
, m_suggestionStr(suggest)
, m_hightlightRanges(res.m_hightlightRanges)
@@ -86,6 +85,11 @@ FeatureID const & Result::GetFeatureID() const
return m_id;
}
+uint32_t Result::GetFeatureType() const
+{
+ return m_featureType;
+}
+
m2::PointD Result::GetFeatureCenter() const
{
ASSERT(HasPoint(), ());
@@ -146,10 +150,14 @@ void Result::PrependCity(string const & name)
string Result::ToStringForStats() const
{
+ string readableType;
+ if (GetResultType() == Type::Feature)
+ readableType = classif().GetReadableObjectName(m_featureType);
+
string s;
s.append(GetString());
s.append("|");
- s.append(GetFeatureTypeName());
+ s.append(readableType);
s.append("|");
s.append(IsSuggest() ? "1" : "0");
return s;
@@ -170,10 +178,14 @@ string DebugPrint(Result::Type type)
string DebugPrint(Result const & result)
{
+ string readableType;
+ if (result.GetResultType() == Result::Type::Feature)
+ readableType = classif().GetReadableObjectName(result.GetFeatureType());
+
ostringstream os;
os << "Result [";
os << "name: " << result.GetString() << ", ";
- os << "type: " << result.GetFeatureTypeName() << ", ";
+ os << "type: " << readableType << ", ";
os << "info: " << DebugPrint(result.GetRankingInfo());
os << "]";
return os.str();
diff --git a/search/result.hpp b/search/result.hpp
index a62d6265b2..41631e44d0 100644
--- a/search/result.hpp
+++ b/search/result.hpp
@@ -64,8 +64,7 @@ public:
// For Type::Feature.
Result(FeatureID const & id, m2::PointD const & pt, std::string const & str,
- std::string const & address, std::string const & featureTypeName, uint32_t featureType,
- Metadata const & meta);
+ std::string const & address, uint32_t featureType, Metadata const & meta);
// For Type::LatLon.
Result(m2::PointD const & pt, std::string const & latlon, std::string const & address);
@@ -80,7 +79,6 @@ public:
std::string const & GetString() const { return m_str; }
std::string const & GetAddress() const { return m_address; }
- std::string const & GetFeatureTypeName() const { return m_featureTypeName; }
std::string const & GetCuisine() const { return m_metadata.m_cuisine; }
float GetHotelRating() const { return m_metadata.m_hotelRating; }
std::string const & GetHotelApproximatePricing() const
@@ -99,6 +97,9 @@ public:
// Precondition: GetResultType() == Type::Feature.
FeatureID const & GetFeatureID() const;
+ // Precondition: GetResultType() == Type::Feature.
+ uint32_t GetFeatureType() const;
+
// Center point of a feature.
// Precondition: HasPoint() == true.
m2::PointD GetFeatureCenter() const;
@@ -139,8 +140,7 @@ private:
m2::PointD m_center;
std::string m_str;
std::string m_address;
- std::string m_featureTypeName;
- uint32_t m_featureType;
+ uint32_t m_featureType = 0;
std::string m_suggestionStr;
buffer_vector<std::pair<uint16_t, uint16_t>, 4> m_hightlightRanges;
diff --git a/search/search_quality/assessment_tool/result_view.cpp b/search/search_quality/assessment_tool/result_view.cpp
index e4dcd125cb..6e1248d082 100644
--- a/search/search_quality/assessment_tool/result_view.cpp
+++ b/search/search_quality/assessment_tool/result_view.cpp
@@ -3,6 +3,8 @@
#include "search/result.hpp"
#include "search/search_quality/assessment_tool/helpers.hpp"
+#include "indexer/classificator.hpp"
+
#include <memory>
#include <utility>
#include <vector>
@@ -39,6 +41,15 @@ string GetResultType(search::Sample::Result const & result)
{
return strings::JoinStrings(result.m_types, ", ");
}
+
+string GetResultType(search::Result const & result)
+{
+ string readableType;
+ if (result.GetResultType() == search::Result::Type::Feature)
+ return readableType = classif().GetReadableObjectName(result.GetFeatureType());
+
+ return "";
+}
} // namespace
ResultView::ResultView(string const & name, string const & type, string const & address,
@@ -52,7 +63,7 @@ ResultView::ResultView(string const & name, string const & type, string const &
}
ResultView::ResultView(search::Result const & result, QWidget & parent)
- : ResultView(result.GetString(), result.GetFeatureTypeName(), result.GetAddress(), parent)
+ : ResultView(result.GetString(), GetResultType(result), result.GetAddress(), parent)
{
}
diff --git a/search/search_tests/results_tests.cpp b/search/search_tests/results_tests.cpp
index 9aaf1ccd8d..78af3ae335 100644
--- a/search/search_tests/results_tests.cpp
+++ b/search/search_tests/results_tests.cpp
@@ -13,7 +13,7 @@ UNIT_TEST(Results_Sorting)
for (uint32_t i = 5; i != 0; --i)
{
r.AddResultNoChecks({{id, i}, {} /* pt */, {} /* str */, {} /* address */,
- {} /* featureTypeName */, {} /* featureType */, {} /* metadata */});
+ {} /* featureType */, {} /* metadata */});
}
for (auto it = r.begin(); it != r.end(); ++it)
@@ -42,7 +42,7 @@ UNIT_TEST(Result_PrependCity)
{
Result r(fid, m2::PointD::Zero(), "" /* str */, "Moscow, Russia" /* address */,
- "" /* featureTypeName */, 0 /* featureType */, meta);
+ 0 /* featureType */, meta);
r.PrependCity("Moscow");
TEST_EQUAL(r.GetAddress(), "Moscow, Russia", ());
@@ -50,8 +50,7 @@ UNIT_TEST(Result_PrependCity)
{
Result r(fid, m2::PointD::Zero(), "улица Михася Лынькова" /* str */,
- "Минская область, Беларусь" /* address */, "" /* featureTypeName */,
- 0 /* featureType */, meta);
+ "Минская область, Беларусь" /* address */, 0 /* featureType */, meta);
r.PrependCity("Минск");
TEST_EQUAL(r.GetAddress(), "Минск, Минская область, Беларусь", ());
diff --git a/tools/unix/generate_localizations.sh b/tools/unix/generate_localizations.sh
index cf5aa9744c..60b5b23645 100755
--- a/tools/unix/generate_localizations.sh
+++ b/tools/unix/generate_localizations.sh
@@ -5,7 +5,7 @@ OMIM_PATH="$(dirname "$0")/../.."
TWINE="$OMIM_PATH/tools/twine/twine"
MERGED_FILE="$(mktemp)"
-cat "$OMIM_PATH/strings.txt" "$OMIM_PATH/partners_strings.txt" "$OMIM_PATH/data/strings_types.txt" > "$MERGED_FILE"
+cat "$OMIM_PATH/strings.txt" "$OMIM_PATH/partners_strings.txt" "$OMIM_PATH/data/types_strings.txt" > "$MERGED_FILE"
# TODO: Add "--untagged --tags android" when tags are properly set.
# TODO: Add validate-strings-file call to check for duplicates (and avoid Android build errors) when tags are properly set.