]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #1996 from lonvia/remove-postcode-search-structured
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 6 Oct 2020 15:04:22 +0000 (17:04 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Oct 2020 15:04:22 +0000 (17:04 +0200)
Restrict postcode searches to postcode in first token

lib/SearchDescription.php
test/bdd/api/search/queries.feature

index 33b766a5f5fcacbe09f596d6221370ca49456ef9..ad404528968ad94075bc414af0bc0f5a185873cc 100644 (file)
@@ -199,15 +199,10 @@ class SearchDescription
         } elseif (($sPhraseType == '' || $sPhraseType == 'postalcode')
                   && is_a($oSearchTerm, '\Nominatim\Token\Postcode')
         ) {
-            // We need to try the case where the postal code is the primary element
-            // (i.e. no way to tell if it is (postalcode, city) OR (city, postalcode)
-            // so try both.
             if (!$this->sPostcode) {
                 // If we have structured search or this is the first term,
                 // make the postcode the primary search element.
-                if ($this->iOperator == Operator::NONE
-                    && ($sPhraseType == 'postalcode' || $bFirstToken)
-                ) {
+                if ($this->iOperator == Operator::NONE && $bFirstToken) {
                     $oSearch = clone $this;
                     $oSearch->iSearchRank++;
                     $oSearch->iOperator = Operator::POSTCODE;
index a9719fb2d68d861a6541f8d7f0632fc274191008..e5040f1e247b79ab8bb2808df568ce9dea8436b7 100644 (file)
@@ -24,7 +24,6 @@ Feature: Search queries
           | house_number  | 86 |
           | road          | Schellingstraße |
           | suburb        | Eilbek |
-          | neighbourhood | Auenviertel |
           | postcode      | 22089 |
           | city          | Hamburg |
           | country       | Deutschland |
@@ -38,7 +37,6 @@ Feature: Search queries
           | type          | value |
           | house_number  | 73 |
           | road          | Schellingstraße |
-          | neighbourhood | Auenviertel |
           | suburb        | Eilbek |
           | postcode      | 22089 |
           | city          | Hamburg |