]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow postcodes and housenumbers together
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Oct 2017 18:48:35 +0000 (20:48 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Oct 2017 18:48:35 +0000 (20:48 +0200)
Fixes #805.

lib/Geocode.php

index d96aaac2ff9a55b898910e673067e5ec2a8a19a1..adae9f77042abdd834814bc4097ba5a76c2bec38 100644 (file)
@@ -748,11 +748,11 @@ class Geocode
                                     }
                                 } elseif (($sPhraseType == '' || $sPhraseType == 'postalcode') && $aSearchTerm['class'] == 'place' && $aSearchTerm['type'] == '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 (!$bHavePostcode && $aSearch['sPostcode'] === '' && $aSearch['sHouseNumber'] === '' &&
+                                    if ($aSearch['sPostcode'] === '' &&
                                         isset($aSearchTerm['word']) && $aSearchTerm['word'] && strpos($sNormQuery, $this->normTerm($aSearchTerm['word'])) !== false) {
                                         // If we have structured search or this is the first term,
                                         // make the postcode the primary search element.
-                                        if ($aSearch['sOperator'] === '' && ($sPhraseType == 'postalcode' || ($iToken == 0 && $iPhrase == 0))) {
+                                        if (!$bHavePostcode && $aSearch['sOperator'] === '' && ($sPhraseType == 'postalcode' || ($iToken == 0 && $iPhrase == 0))) {
                                             $aNewSearch = $aSearch;
                                             $aNewSearch['sOperator'] = 'postcode';
                                             $aNewSearch['aAddress'] = array_merge($aNewSearch['aAddress'], $aNewSearch['aName']);