From 0d2cdb5c2f2cb6836e64d99c04a51c561c0ab7ac Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 6 Oct 2017 20:48:35 +0200 Subject: [PATCH] allow postcodes and housenumbers together Fixes #805. --- lib/Geocode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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']); -- 2.39.5