From: Sarah Hoffmann Date: Tue, 6 Oct 2020 15:04:22 +0000 (+0200) Subject: Merge pull request #1996 from lonvia/remove-postcode-search-structured X-Git-Tag: v3.6.0~58 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/7cd330ee55d7dd141b36ddd1db963120d67cabe4?hp=cd997ff0589f583b0712d6652e614320a7c8a917 Merge pull request #1996 from lonvia/remove-postcode-search-structured Restrict postcode searches to postcode in first token --- diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 33b766a5..ad404528 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -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; diff --git a/test/bdd/api/search/queries.feature b/test/bdd/api/search/queries.feature index a9719fb2..e5040f1e 100644 --- a/test/bdd/api/search/queries.feature +++ b/test/bdd/api/search/queries.feature @@ -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 |