]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/PlaceLookup.php
Merge pull request #2974 from bloom256/main-tag-in-reverse-lookup
[nominatim.git] / lib-php / PlaceLookup.php
index 715f1ced3daab48dbd95b374465f44ff6e93d050..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, ';
@@ -445,7 +447,7 @@ class PlaceLookup
 
             if ($this->bExtraTags) {
                 if ($aPlace['extra']) {
-                    $aPlace['sExtraTags'] = json_decode($aPlace['extra']);
+                    $aPlace['sExtraTags'] = json_decode($aPlace['extra'], true);
                 } else {
                     $aPlace['sExtraTags'] = (object) array();
                 }
@@ -482,7 +484,7 @@ class PlaceLookup
             return (object) array();
         }
 
-        $aFullNames = json_decode($sNames);
+        $aFullNames = json_decode($sNames, true);
         $aNames = array();
 
         foreach ($aFullNames as $sKey => $sValue) {