X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/563099f7fa0f03ce563020803b21bb8cc882e468..0ecb920866cea50294d1124b85f971626355d520:/lib/Geocode.php diff --git a/lib/Geocode.php b/lib/Geocode.php index eae3baf8..7f1c4edc 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1272,13 +1272,16 @@ class Geocode if (CONST_Debug) echo "
Search Loop, group $iGroupLoop, loop $iQueryLoop"; if (CONST_Debug) _debugDumpGroupedSearches(array($iGroupedRank => array($aSearch)), $aValidTokens); + if ($sCountryCodesSQL && $aSearch['sCountryCode'] && !in_array($aSearch['sCountryCode'], $this->aCountryCodes)) { + continue; + } + // No location term? if (!sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress']) && !$aSearch['oNear']) { if ($aSearch['sCountryCode'] && !$aSearch['sClass'] && !$aSearch['sHouseNumber']) { // Just looking for a country by code - look it up if (4 >= $this->iMinAddressRank && 4 <= $this->iMaxAddressRank) { $sSQL = "SELECT place_id FROM placex WHERE country_code='".$aSearch['sCountryCode']."' AND rank_search = 4"; - if ($sCountryCodesSQL) $sSQL .= " AND country_code in ($sCountryCodesSQL)"; if ($bBoundingBoxSearch) $sSQL .= " AND _st_intersects($this->sViewboxSmallSQL, geometry)"; $sSQL .= " ORDER BY st_area(geometry) DESC LIMIT 1"; @@ -1349,8 +1352,7 @@ class Geocode $sSQL .= "p.postcode = '".pg_escape_string(reset($aSearch['aName']))."'"; if ($aSearch['sCountryCode']) { $sSQL .= " AND p.country_code = '".$aSearch['sCountryCode']."'"; - } - if ($sCountryCodesSQL) { + } elseif ($sCountryCodesSQL) { $sSQL .= " AND p.country_code in ($sCountryCodesSQL)"; } $sSQL .= " LIMIT $this->iLimit";