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
path: root/search
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2019-02-04 18:11:33 +0300
committerTatiana Yan <tatiana.kondakova@gmail.com>2019-02-20 20:49:23 +0300
commitce161beb47921be5b9612ad94e37473d6206dcf7 (patch)
tree718b777dca782cb40353a76407ad387a5c6c90bb /search
parenta39b1257c883eced6cb270587b2d2b4047655ac8 (diff)
[search] Reenabled the relaxed search.
Diffstat (limited to 'search')
-rw-r--r--search/geocoder.cpp11
-rw-r--r--search/geocoder_context.hpp2
-rw-r--r--search/search_integration_tests/processor_test.cpp208
3 files changed, 112 insertions, 109 deletions
diff --git a/search/geocoder.cpp b/search/geocoder.cpp
index e22b3367f0..3a64b1c9b5 100644
--- a/search/geocoder.cpp
+++ b/search/geocoder.cpp
@@ -1041,12 +1041,15 @@ void Geocoder::CreateStreetsLayerAndMatchLowerLayers(BaseContext & ctx,
layer.m_sortedFeatures = &sortedFeatures;
ScopedMarkTokens mark(ctx.m_tokens, BaseContext::TOKEN_TYPE_STREET, prediction.m_tokenRange);
-// size_t const numEmitted = ctx.m_numEmitted;
+ size_t const numEmitted = ctx.m_numEmitted;
+
+ LOG(LINFO, ("num emitted1", ctx.m_numEmitted));
MatchPOIsAndBuildings(ctx, 0 /* curToken */);
+ LOG(LINFO, ("num emitted2", ctx.m_numEmitted));
// A relaxed best effort parse: at least show the street if we can find one.
-// if (numEmitted == ctx.m_numEmitted)
-// FindPaths(ctx);
+ if (numEmitted == ctx.m_numEmitted)
+ FindPaths(ctx);
}
void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken)
@@ -1379,7 +1382,7 @@ void Geocoder::EmitResult(BaseContext & ctx, MwmSet::MwmId const & mwmId, uint32
else
m_preRanker.Emplace(id, info, m_params.m_tracer->GetProvenance());
- // ++ctx.m_numEmitted;
+ ++ctx.m_numEmitted;
}
void Geocoder::EmitResult(BaseContext & ctx, Region const & region, TokenRange const & tokenRange,
diff --git a/search/geocoder_context.hpp b/search/geocoder_context.hpp
index 94b9266d30..f63ea8365a 100644
--- a/search/geocoder_context.hpp
+++ b/search/geocoder_context.hpp
@@ -76,7 +76,7 @@ struct BaseContext
// The total number of results emitted using this
// context in all branches of the search.
- // size_t m_numEmitted = 0;
+ size_t m_numEmitted = 0;
std::unique_ptr<hotels_filter::HotelsFilter::ScopedFilter> m_hotelsFilter;
std::unique_ptr<cuisine_filter::CuisineFilter::ScopedFilter> m_cuisineFilter;
diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp
index a060412beb..d4d351a199 100644
--- a/search/search_integration_tests/processor_test.cpp
+++ b/search/search_integration_tests/processor_test.cpp
@@ -602,27 +602,27 @@ UNIT_CLASS_TEST(ProcessorTest, TestHouseNumbers)
{
Rules rules{ExactMatch(countryId, building0), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград генералова к100 ", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград генералова к100 ", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building1), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград генералова к200 ", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград генералова к200 ", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building1), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград к200 генералова ", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград к200 генералова ", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building2), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград 300 строение 400 генералова ", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград 300 строение 400 генералова ", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград генералова строе 300", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград генералова строе 300", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building2), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Зеленоград генералова 300 строе", "ru", rules), ());
+ TEST(ResultsMatch("Зеленоград генералова 300 строе", "ru", rules), ());
}
}
@@ -701,11 +701,11 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes)
{
Rules rules{ExactMatch(countryId, building28), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Долгопрудный первомайская 28а ", "ru", rules), ());
+ TEST(ResultsMatch("Долгопрудный первомайская 28а ", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building28), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Долгопрудный первомайская 28а, 141701", "ru", rules), ());
+ TEST(ResultsMatch("Долгопрудный первомайская 28а, 141701", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building28), ExactMatch(countryId, building29),
@@ -714,7 +714,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes)
}
{
Rules rules{ExactMatch(countryId, building31), ExactMatch(countryId, street)};
- // TEST(ResultsMatch("Долгопрудный первомайская 141702", "ru", rules), ());
+ TEST(ResultsMatch("Долгопрудный первомайская 141702", "ru", rules), ());
}
{
Rules rules{ExactMatch(countryId, building28), ExactMatch(countryId, building29),
@@ -1050,16 +1050,16 @@ UNIT_CLASS_TEST(ProcessorTest, FuzzyMatch)
Rules rulesWithoutStreet = {ExactMatch(id, bar)};
Rules rules = {ExactMatch(id, bar), ExactMatch(id, street)};
TEST(ResultsMatch("москва черчилль", "ru", rulesWithoutStreet), ());
-// TEST(ResultsMatch("москва ленинградский черчилль", "ru", rules), ());
-// TEST(ResultsMatch("москва ленинградский паб черчилль", "ru", rules), ());
+ TEST(ResultsMatch("москва ленинградский черчилль", "ru", rules), ());
+ TEST(ResultsMatch("москва ленинградский паб черчилль", "ru", rules), ());
-// TEST(ResultsMatch("масква лининградский черчиль", "ru", rules), ());
-// TEST(ResultsMatch("масква ленинргадский черчиль", "ru", rules), ());
+ TEST(ResultsMatch("масква лининградский черчиль", "ru", rules), ());
+ TEST(ResultsMatch("масква ленинргадский черчиль", "ru", rules), ());
// Too many errors, can't do anything.
TEST(ResultsMatch("масква лениноргадсский чирчиль", "ru", Rules{}), ());
- // TEST(ResultsMatch("моксва ленинргадский черчиль", "ru", rules), ());
+ TEST(ResultsMatch("моксва ленинргадский черчиль", "ru", rules), ());
TEST(ResultsMatch("food", "ru", rulesWithoutStreet), ());
TEST(ResultsMatch("foood", "ru", rulesWithoutStreet), ());
@@ -1140,7 +1140,7 @@ UNIT_CLASS_TEST(ProcessorTest, StopWords)
{
TEST(ResultsMatch("la motviderie ", "fr", Rules{}), ());
- // TEST(ResultsMatch("la la le la la la ", "fr", {ExactMatch(id, street)}), ());
+ TEST(ResultsMatch("la la le la la la ", "fr", {ExactMatch(id, street)}), ());
TEST(ResultsMatch("la la le la la la", "fr", Rules{}), ());
}
}
@@ -1201,7 +1201,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestWeirdTypes)
TEST(ResultsMatch("東京 除細動器 ", "ja", onlyFirst), ());
// City + street + category.
-// TEST(ResultsMatch("東京 竹下通り 除細動器 ", "ja", firstWithStreet), ());
+ TEST(ResultsMatch("東京 竹下通り 除細動器 ", "ja", firstWithStreet), ());
}
{
@@ -1293,94 +1293,94 @@ UNIT_CLASS_TEST(ProcessorTest, CityBoundarySmoke)
}
}
-// // Tests for the non-strict aspects of retrieval.
-// // Currently, the only possible non-strictness is that
-// // some tokens in the query may be ignored,
-// // which results in a pruned parse tree for the query.
-// UNIT_CLASS_TEST(ProcessorTest, RelaxedRetrieval)
-// {
-// string const countryName = "Wonderland";
-// TestCountry country(m2::PointD(10.0, 10.0), countryName, "en");
-
-// TestCity city({{-10.0, -10.0}, {10.0, -10.0}, {10.0, 10.0}, {-10.0, 10.0}} /* boundary */,
-// "Sick City", "en", 255 /* rank */);
-
-// TestStreet street(vector<m2::PointD>{m2::PointD(-1.0, 0.0), m2::PointD(1.0, 0.0)}, "Queer Street",
-// "en");
-// TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street, "en");
-// TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street, "en");
-// TestBuilding building2(m2::PointD(2.0, 0.0), "named building", "" /* house number */, "en");
-// TestBuilding building3(m2::PointD(3.0, 0.0), "named building", "", "en");
-
-// TestPOI poi0(m2::PointD(-1.0, 0.0), "Farmacia de guardia", "en");
-// poi0.SetTypes({{"amenity", "pharmacy"}});
-
-// // A poi inside building2.
-// TestPOI poi2(m2::PointD(2.0, 0.0), "Post box", "en");
-// poi2.SetTypes({{"amenity", "post_box"}});
-
-// auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) {
-// builder.Add(street);
-// builder.Add(building0);
-// builder.Add(building1);
-// builder.Add(poi0);
-// });
-// RegisterCountry(countryName, m2::RectD(m2::PointD(-10.0, -10.0), m2::PointD(10.0, 10.0)));
-
-// auto worldId = BuildWorld([&](TestMwmBuilder & builder) {
-// builder.Add(country);
-// builder.Add(city);
-// });
-
-// {
-// Rules rulesStrict = {ExactMatch(countryId, building0)};
-// Rules rulesRelaxed = {ExactMatch(countryId, street)};
-
-// // "street" instead of "street-building"
-// TEST(ResultsMatch("queer street 0 ", rulesStrict), ());
-// TEST(ResultsMatch("queer street ", rulesRelaxed), ());
-// TEST(ResultsMatch("queer street 2 ", rulesRelaxed), ());
-// }
-
-// {
-// Rules rulesStrict = {ExactMatch(countryId, poi0), ExactMatch(countryId, street)};
-// Rules rulesRelaxed = {ExactMatch(countryId, street)};
-
-// // "country-city-street" instead of "country-city-street-poi"
-// TEST(ResultsMatch("wonderland sick city queer street pharmacy ", rulesStrict), ());
-// TEST(ResultsMatch("wonderland sick city queer street school ", rulesRelaxed), ());
-// }
-
-// {
-// Rules rulesStrict = {ExactMatch(countryId, street)};
-// Rules rulesRelaxed = {};
-
-// // Cities and larger toponyms should not be relaxed.
-// // "city" instead of "city-street"
-// TEST(ResultsMatch("sick city queer street ", rulesStrict), ());
-// TEST(ResultsMatch("sick city sick street ", rulesRelaxed), ());
-// }
-
-// {
-// Rules rulesStrict = {ExactMatch(countryId, street)};
-// Rules rulesRelaxed = {};
-
-// // Should not be relaxed.
-// // "country-city" instead of "country-city-street"
-// TEST(ResultsMatch("wonderland sick city queer street ", rulesStrict), ());
-// TEST(ResultsMatch("wonderland sick city other street ", rulesRelaxed), ());
-// }
-
-// {
-// Rules rulesStrict = {ExactMatch(countryId, poi0)};
-// Rules rulesRelaxed = {};
-
-// // Should not be relaxed.
-// // "city" instead of "city-poi"
-// TEST(ResultsMatch("sick city pharmacy ", rulesStrict), ());
-// TEST(ResultsMatch("sick city library ", rulesRelaxed), ());
-// }
-// }
+// Tests for the non-strict aspects of retrieval.
+// Currently, the only possible non-strictness is that
+// some tokens in the query may be ignored,
+// which results in a pruned parse tree for the query.
+UNIT_CLASS_TEST(ProcessorTest, RelaxedRetrieval)
+{
+ string const countryName = "Wonderland";
+ TestCountry country(m2::PointD(10.0, 10.0), countryName, "en");
+
+ TestCity city({{-10.0, -10.0}, {10.0, -10.0}, {10.0, 10.0}, {-10.0, 10.0}} /* boundary */,
+ "Sick City", "en", 255 /* rank */);
+
+ TestStreet street(vector<m2::PointD>{m2::PointD(-1.0, 0.0), m2::PointD(1.0, 0.0)}, "Queer Street",
+ "en");
+ TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street, "en");
+ TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street, "en");
+ TestBuilding building2(m2::PointD(2.0, 0.0), "named building", "" /* house number */, "en");
+ TestBuilding building3(m2::PointD(3.0, 0.0), "named building", "", "en");
+
+ TestPOI poi0(m2::PointD(-1.0, 0.0), "Farmacia de guardia", "en");
+ poi0.SetTypes({{"amenity", "pharmacy"}});
+
+ // A poi inside building2.
+ TestPOI poi2(m2::PointD(2.0, 0.0), "Post box", "en");
+ poi2.SetTypes({{"amenity", "post_box"}});
+
+ auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) {
+ builder.Add(street);
+ builder.Add(building0);
+ builder.Add(building1);
+ builder.Add(poi0);
+ });
+ RegisterCountry(countryName, m2::RectD(m2::PointD(-10.0, -10.0), m2::PointD(10.0, 10.0)));
+
+ auto worldId = BuildWorld([&](TestMwmBuilder & builder) {
+ builder.Add(country);
+ builder.Add(city);
+ });
+
+ {
+ Rules rulesStrict = {ExactMatch(countryId, building0)};
+ Rules rulesRelaxed = {ExactMatch(countryId, street)};
+
+ // "street" instead of "street-building"
+ TEST(ResultsMatch("queer street 0 ", rulesStrict), ());
+ TEST(ResultsMatch("queer street ", rulesRelaxed), ());
+ TEST(ResultsMatch("queer street 2 ", rulesRelaxed), ());
+ }
+
+ {
+ Rules rulesStrict = {ExactMatch(countryId, poi0), ExactMatch(countryId, street)};
+ Rules rulesRelaxed = {ExactMatch(countryId, street)};
+
+ // "country-city-street" instead of "country-city-street-poi"
+ TEST(ResultsMatch("wonderland sick city queer street pharmacy ", rulesStrict), ());
+ TEST(ResultsMatch("wonderland sick city queer street school ", rulesRelaxed), ());
+ }
+
+ {
+ Rules rulesStrict = {ExactMatch(countryId, street)};
+ Rules rulesRelaxed = {};
+
+ // Cities and larger toponyms should not be relaxed.
+ // "city" instead of "city-street"
+ TEST(ResultsMatch("sick city queer street ", rulesStrict), ());
+ TEST(ResultsMatch("sick city sick street ", rulesRelaxed), ());
+ }
+
+ {
+ Rules rulesStrict = {ExactMatch(countryId, street)};
+ Rules rulesRelaxed = {};
+
+ // Should not be relaxed.
+ // "country-city" instead of "country-city-street"
+ TEST(ResultsMatch("wonderland sick city queer street ", rulesStrict), ());
+ TEST(ResultsMatch("wonderland sick city other street ", rulesRelaxed), ());
+ }
+
+ {
+ Rules rulesStrict = {ExactMatch(countryId, poi0)};
+ Rules rulesRelaxed = {};
+
+ // Should not be relaxed.
+ // "city" instead of "city-poi"
+ TEST(ResultsMatch("sick city pharmacy ", rulesStrict), ());
+ TEST(ResultsMatch("sick city library ", rulesRelaxed), ());
+ }
+}
UNIT_CLASS_TEST(ProcessorTest, PathsThroughLayers)
{