mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add support for lookup of linked places
This commit is contained in:
@@ -187,12 +187,12 @@ class PlaceLookup
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aResults = $this->lookup(array($iPlaceID => new Result($iPlaceID)));
|
$aResults = $this->lookup(array($iPlaceID => new Result($iPlaceID)), 0, 30, true);
|
||||||
|
|
||||||
return empty($aResults) ? null : reset($aResults);
|
return empty($aResults) ? null : reset($aResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30)
|
public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30, $bAllowLinked = false)
|
||||||
{
|
{
|
||||||
Debug::newFunction('Place lookup');
|
Debug::newFunction('Place lookup');
|
||||||
|
|
||||||
@@ -247,7 +247,9 @@ class PlaceLookup
|
|||||||
if ($this->sAllowedTypesSQLList) {
|
if ($this->sAllowedTypesSQLList) {
|
||||||
$sSQL .= 'AND placex.class in '.$this->sAllowedTypesSQLList;
|
$sSQL .= 'AND placex.class in '.$this->sAllowedTypesSQLList;
|
||||||
}
|
}
|
||||||
$sSQL .= ' AND linked_place_id is null ';
|
if (!$bAllowLinked) {
|
||||||
|
$sSQL .= ' AND linked_place_id is null ';
|
||||||
|
}
|
||||||
$sSQL .= ' GROUP BY ';
|
$sSQL .= ' GROUP BY ';
|
||||||
$sSQL .= ' osm_type, ';
|
$sSQL .= ' osm_type, ';
|
||||||
$sSQL .= ' osm_id, ';
|
$sSQL .= ' osm_id, ';
|
||||||
|
|||||||
@@ -31,3 +31,11 @@ Feature: Places by osm_type and osm_id Tests
|
|||||||
| jsonv2 |
|
| jsonv2 |
|
||||||
| geojson |
|
| geojson |
|
||||||
| xml |
|
| xml |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Lookup of a linked place
|
||||||
|
When sending geocodejson lookup query for N1932181216
|
||||||
|
Then exactly 1 result is returned
|
||||||
|
And results contain
|
||||||
|
| name |
|
||||||
|
| Vaduz |
|
||||||
|
|||||||
Reference in New Issue
Block a user