X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2723553593f2c52ebf981d958942cc473f3db7e3..966ba4fe678284ff9cc6ac5f1385b78dc0b74675:/lib-php/PlaceLookup.php diff --git a/lib-php/PlaceLookup.php b/lib-php/PlaceLookup.php index 715f1ced..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, '; @@ -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) {