From: Sarah Hoffmann Date: Wed, 8 Oct 2014 21:31:33 +0000 (+0200) Subject: respect bounded in country searches X-Git-Tag: v2.4.0~81 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/e62ae5b090661f7fa56cc68981457e5b4d4bd9ca?ds=sidebyside respect bounded in country searches fixes trac 5238 --- diff --git a/lib/Geocode.php b/lib/Geocode.php index bb463445..7f00de6e 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1156,6 +1156,8 @@ { $sSQL = "select place_id from placex where calculated_country_code='".$aSearch['sCountryCode']."' and rank_search = 4"; if ($sCountryCodesSQL) $sSQL .= " and calculated_country_code in ($sCountryCodesSQL)"; + if ($bBoundingBoxSearch) + $sSQL .= " and st_overlaps($this->sViewboxSmallSQL, geometry)"; $sSQL .= " order by st_area(geometry) desc limit 1"; if (CONST_Debug) var_dump($sSQL); $aPlaceIDs = $this->oDB->getCol($sSQL); diff --git a/tests/features/api/regression.feature b/tests/features/api/regression.feature index 3e409fe8..f1887e1a 100644 --- a/tests/features/api/regression.feature +++ b/tests/features/api/regression.feature @@ -177,3 +177,10 @@ Feature: API regression tests Then results contain | ID | class | latlon | 0 | highway | 51.8324206,1.2447352 +-100m + + Scenario: trac #5238 + Given the request parameters + | bounded | viewbox + | 1 | 0,0,-1,-1 + When sending json search query "sy" + Then exactly 0 results are returned