]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
Revert "increase inital search radius for reverse"
[nominatim.git] / website / search.php
index d486ed66ba5361bec57f7f3d59bbaa50ec2cfef3..aa0e870adb5c4242015b16f39f2b8af5b6fc903e 100755 (executable)
 
        // 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))."]";
 
                                $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];
                                                        $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)