X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/872795ff8ec7929e213dee69427de5d92e2370ad..92c51767f75ee931e74cf04d278bca39b6cee032:/website/search.php diff --git a/website/search.php b/website/search.php index a5350695..aa0e870a 100755 --- a/website/search.php +++ b/website/search.php @@ -270,7 +270,7 @@ $sQuery = trim(str_replace($aData[0], ' ', $sQuery)); } } - elseif (preg_match('/(\\[|^|\\b)(-?[0-9]+[0-9.]*)[, ]+(-?[0-9]+[0-9.]*)(\\]|$|\\b)/', $sQuery, $aData)) + elseif (preg_match('/(\\[|^|\\b)(-?[0-9]+[0-9]*\\.[0-9]+)[, ]+(-?[0-9]+[0-9]*\\.[0-9]+)(\\]|$|\\b)/', $sQuery, $aData)) { $fQueryLat = $aData[2]; $fQueryLon = $aData[3]; @@ -451,6 +451,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)