X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/00a3e843e3fb4a6fc735a019cdf7a3e38558cad6..92c51767f75ee931e74cf04d278bca39b6cee032:/website/search.php diff --git a/website/search.php b/website/search.php index d486ed66..aa0e870a 100755 --- a/website/search.php +++ b/website/search.php @@ -75,10 +75,13 @@ // Preferred language $aLangPrefOrder = getPreferredLanguages(); + $bReverseInPlan = true; + /* if (isset($aLangPrefOrder['name:de'])) $bReverseInPlan = true; if (isset($aLangPrefOrder['name:ru'])) $bReverseInPlan = true; if (isset($aLangPrefOrder['name:ja'])) $bReverseInPlan = true; if (isset($aLangPrefOrder['name:pl'])) $bReverseInPlan = true; + */ $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]"; @@ -267,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]; @@ -448,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)