]> git.openstreetmap.org Git - nominatim.git/commitdiff
On postcode searches observe given bounded viewbox
authormarc tobias <mtmail@gmx.net>
Tue, 2 Apr 2019 12:49:31 +0000 (14:49 +0200)
committermarc tobias <mtmail@gmx.net>
Tue, 2 Apr 2019 12:49:31 +0000 (14:49 +0200)
lib/SearchDescription.php
test/bdd/api/search/postcode.feature

index 358e6969577f97ac52031c7bd10689572c405d6f..506d4202253f61f909c46f3d1c08275b2c12faa9 100644 (file)
@@ -588,6 +588,9 @@ class SearchDescription
 
         $sSQL .= "p.postcode = '".reset($this->aName)."'";
         $sSQL .= $this->countryCodeSQL(' AND p.country_code');
+        if ($this->oContext->bViewboxBounded) {
+            $sSQL .= ' AND ST_Intersects('.$this->oContext->sqlViewboxSmall.', geometry)';
+        }
         $sSQL .= $this->oContext->excludeSQL(' AND p.place_id');
         $sSQL .= " LIMIT $iLimit";
 
index 63c8646946cb2d1170879b17c6ff0a9268340650..e70495f63890f15c958bb75a86ec072963fca68f 100644 (file)
@@ -26,6 +26,18 @@ Feature: Searches with postcodes
             | country_code |
             | li           |
 
+    Scenario: Postcode search with bounded viewbox restriction
+        When sending json search query "9486" with address
+          | bounded | viewbox |
+          | 1       | 9.55,47.20,9.58,47.22 |
+        Then result addresses contain
+            | postcode |
+            | 9486     |
+        When sending json search query "9486" with address
+          | bounded | viewbox                 |
+          | 1       | 5.00,20.00,6.00,21.00 |
+        Then exactly 0 results are returned
+
     Scenario: Postcode search with structured query
         When sending json search query "" with address
             | postalcode | country |