From: Sarah Hoffmann Date: Thu, 17 Nov 2022 12:35:53 +0000 (+0100) Subject: Merge pull request #2887 from lonvia/lookup-linked-places X-Git-Tag: v4.2.0~9 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/52456230cc32d50b59a482f878f0f270981bfe91?hp=4422533adbb378190defb314e3f567c2a49826ca Merge pull request #2887 from lonvia/lookup-linked-places Add support for lookup of linked places --- diff --git a/lib-php/PlaceLookup.php b/lib-php/PlaceLookup.php index 33156537..ba4f50bc 100644 --- a/lib-php/PlaceLookup.php +++ b/lib-php/PlaceLookup.php @@ -187,12 +187,12 @@ class PlaceLookup 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); } - public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30) + public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30, $bAllowLinked = false) { Debug::newFunction('Place lookup'); @@ -247,7 +247,9 @@ class PlaceLookup if ($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 .= ' osm_type, '; $sSQL .= ' osm_id, '; diff --git a/test/bdd/api/lookup/simple.feature b/test/bdd/api/lookup/simple.feature index 6aae8c48..9ea38812 100644 --- a/test/bdd/api/lookup/simple.feature +++ b/test/bdd/api/lookup/simple.feature @@ -31,3 +31,11 @@ Feature: Places by osm_type and osm_id Tests | jsonv2 | | geojson | | 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 |