From: Sarah Hoffmann Date: Fri, 6 Oct 2017 18:48:35 +0000 (+0200) Subject: allow postcodes and housenumbers together X-Git-Tag: v3.1.0~54 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/0d2cdb5c2f2cb6836e64d99c04a51c561c0ab7ac?hp=f8d55b5448b6be721a6ea05567930fe244ead7d1 allow postcodes and housenumbers together Fixes #805. --- diff --git a/lib/Geocode.php b/lib/Geocode.php index d96aaac2..adae9f77 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -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']);