X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/dba5b2f86e3b91eade86a851932004a56b34134e..e1a2d9e61e5905bef2ffaa36353681cd33660215:/lib/Geocode.php?ds=inline diff --git a/lib/Geocode.php b/lib/Geocode.php index b6458725..83618113 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -162,7 +162,7 @@ class Geocode $this->sViewboxCentreSQL = "ST_SetSRID('LINESTRING("; $sSep = ''; - foreach ($this->aRoutePoints as $aPoint) { + foreach ($aRoutePoints as $aPoint) { $fPoint = (float)$aPoint; $this->sViewboxCentreSQL .= $sSep.$fPoint; $sSep = ($sSep == ' ') ? ',' : ' '; @@ -252,7 +252,7 @@ class Geocode $aCountries[] = strtolower($sCountryCode); } } - if (isset($aCountryCodes)) + if (isset($aCountries)) $this->aCountryCodes = $aCountries; } @@ -1160,6 +1160,7 @@ class Geocode && $aWordFrequencyScores[$aSearch['aName'][reset($aSearch['aName'])]] < CONST_Search_NameOnlySearchFrequencyThreshold ) { //$aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join(array_merge($aSearch['aAddress'], $aSearch['aAddressNonSearch']), ",")."]"; + $aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join($aSearch['aAddress'],",")."]"; } else { $aTerms[] = "nameaddress_vector @> ARRAY[".join($aSearch['aAddress'], ",")."]"; /*if (sizeof($aSearch['aAddressNonSearch'])) { @@ -1467,7 +1468,7 @@ class Geocode } } else { // Just interpret as a reverse geocode - $oReverse = new Nominatim\ReverseGeocode($this->oDB); + $oReverse = new ReverseGeocode($this->oDB); $oReverse->setZoom(18); $aLookup = $oReverse->lookup( @@ -1480,6 +1481,7 @@ class Geocode if ($aLookup['place_id']) { $aSearchResults = $this->getDetails(array($aLookup['place_id'] => -1)); + $aResultPlaceIDs[$aLookup['place_id']] = -1; } else { $aSearchResults = array(); } @@ -1551,7 +1553,7 @@ class Geocode // getAddressDetails() is defined in lib.php and uses the SQL function get_addressdata in functions.sql $aResult['address'] = getAddressDetails($this->oDB, $sLanguagePrefArraySQL, $aResult['place_id'], $aResult['country_code'], $aResultPlaceIDs[$aResult['place_id']]); if ($aResult['extra_place'] == 'city' && !isset($aResult['address']['city'])) { - $aResult['address'] = array_merge(array('city' => array_shift(array_values($aResult['address']))), $aResult['address']); + $aResult['address'] = array_merge(array('city' => array_values($aResult['address'])[0]), $aResult['address']); } }