]> git.openstreetmap.org Git - nominatim.git/commitdiff
add support for lookup of linked places
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 16 Nov 2022 20:11:56 +0000 (21:11 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 16 Nov 2022 20:34:45 +0000 (21:34 +0100)
lib-php/PlaceLookup.php
test/bdd/api/lookup/simple.feature

index 33156537459b87019ba3fe269d1d07a3f58d8032..ba4f50bc8d4c6e4030dc068cdf61e5e9ba7eb9f7 100644 (file)
@@ -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, ';
index 6aae8c4857a5a7f574a4ba5bd729fb783b6db4ba..9ea388122868c54b53d9b2211b942bfb33ecdab2 100644 (file)
@@ -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 |