forked from organicmaps/organicmaps
[search] Forbid poi-building parse.
This commit is contained in:
parent
1524ed1919
commit
a85a7ea0b3
2 changed files with 11 additions and 3 deletions
|
@ -1443,6 +1443,7 @@ bool Geocoder::IsLayerSequenceSane(vector<FeaturesLayer> const & layers) const
|
|||
uint32_t mask = 0;
|
||||
size_t buildingIndex = layers.size();
|
||||
size_t streetIndex = layers.size();
|
||||
size_t poiIndex = layers.size();
|
||||
|
||||
// Following loop returns false iff there are two different layers
|
||||
// of the same search type.
|
||||
|
@ -1461,10 +1462,13 @@ bool Geocoder::IsLayerSequenceSane(vector<FeaturesLayer> const & layers) const
|
|||
buildingIndex = i;
|
||||
else if (layer.m_type == Model::TYPE_STREET)
|
||||
streetIndex = i;
|
||||
else if (layer.m_type == Model::TYPE_POI)
|
||||
poiIndex = i;
|
||||
}
|
||||
|
||||
bool const hasBuildings = buildingIndex != layers.size();
|
||||
bool const hasStreets = streetIndex != layers.size();
|
||||
bool const hasPois = poiIndex != layers.size();
|
||||
|
||||
// Checks that building and street layers are neighbours.
|
||||
if (hasBuildings && hasStreets)
|
||||
|
@ -1474,6 +1478,10 @@ bool Geocoder::IsLayerSequenceSane(vector<FeaturesLayer> const & layers) const
|
|||
if (!buildings.m_tokenRange.AdjacentTo(streets.m_tokenRange))
|
||||
return false;
|
||||
}
|
||||
if (hasBuildings && hasPois && !hasStreets)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1511,9 +1511,9 @@ UNIT_CLASS_TEST(ProcessorTest, PathsThroughLayers)
|
|||
TEST(ResultsMatch("computing street statistical learning cafe ", {rulePoi}), ());
|
||||
TEST(ResultsMatch("computing street 0 cafe ", {rulePoi}), ());
|
||||
|
||||
// POI-BUILDING
|
||||
TEST(ResultsMatch("statistical learning cafe ", {rulePoi}), ());
|
||||
TEST(ResultsMatch("0 cafe ", {rulePoi}), ());
|
||||
// POI-BUILDING is not supported
|
||||
TEST(ResultsMatch("statistical learning cafe ", {}), ());
|
||||
TEST(ResultsMatch("0 cafe ", {}), ());
|
||||
|
||||
// POI-STREET
|
||||
TEST(ResultsMatch("computing street cafe ", {rulePoi}), ());
|
||||
|
|
Loading…
Add table
Reference in a new issue