]> git.openstreetmap.org Git - nominatim.git/commitdiff
respect bounded in country searches
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 8 Oct 2014 21:31:33 +0000 (23:31 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 8 Oct 2014 21:31:33 +0000 (23:31 +0200)
fixes trac 5238

lib/Geocode.php
tests/features/api/regression.feature

index bb463445ef1bcdf9a052bad73749fa62e3efea35..7f00de6e2f054c980adef55425c5f422fb6bc5d0 100644 (file)
                                                                {
                                                                        $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)";
                                                                {
                                                                        $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);
                                                                        $sSQL .= " order by st_area(geometry) desc limit 1";
                                                                        if (CONST_Debug) var_dump($sSQL);
                                                                        $aPlaceIDs = $this->oDB->getCol($sSQL);
index 3e409fe867755d389109b9b62955c988c7051c53..f1887e1a045615063edf5e67b3bd6fcca376b5c1 100644 (file)
@@ -177,3 +177,10 @@ Feature: API regression tests
         Then results contain
          | ID | class   | latlon
          | 0  | highway | 51.8324206,1.2447352 +-100m
         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