From: Sarah Hoffmann Date: Wed, 19 Jun 2013 20:58:46 +0000 (+0200) Subject: support for partial matching of US ZIP+4 codes X-Git-Tag: v2.2.0~58 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/d5e9fc4a0390493361dd3bc58991dd75dc6ed28e support for partial matching of US ZIP+4 codes --- diff --git a/website/search.php b/website/search.php index 92cad8a0..18fcbafc 100755 --- a/website/search.php +++ b/website/search.php @@ -447,6 +447,28 @@ $aValidTokens[$sToken] = $aGBPostcodeLocation; } } + // US ZIP+4 codes - if there is no token, + // merge in the 5-digit ZIP code + else if (!isset($aValidTokens[$sToken]) && preg_match('/^([0-9]{5}) [0-9]{4}$/', $sToken, $aData)) + { + if (isset($aValidTokens[$aData[1]])) + { + foreach($aValidTokens[$aData[1]] as $aToken) + { + if (!$aToken['class']) + { + if (isset($aValidTokens[$sToken])) + { + $aValidTokens[$sToken][] = $aToken; + } + else + { + $aValidTokens[$sToken] = array($aToken); + } + } + } + } + } } foreach($aTokens as $sToken)