X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e65f1c0c1ab4796ae5342907a76fd6f659b5bf72..fec4c3c30189a771e177d585b8d4ad95e697fc00:/website/search.php diff --git a/website/search.php b/website/search.php index 48035998..c6aa05d1 100755 --- a/website/search.php +++ b/website/search.php @@ -101,7 +101,6 @@ $aPhrases = array_reverse($aPhrases); $sQuery = join(', ',$aPhrases); } - if ($sQuery) { $hLog = logStart($oDB, 'search', $sQuery, $aLangPrefOrder); @@ -113,6 +112,7 @@ $sQuery = preg_replace('/\\bil\\b/','illinois', $sQuery); $sQuery = preg_replace('/\\bal\\b/','alabama', $sQuery); $sQuery = preg_replace('/\\bla\\b/','louisiana', $sQuery); + $sQuery = preg_replace('/\\bde louisiana\\b/','de la', $sQuery); } // If we have a view box create the SQL @@ -191,7 +191,7 @@ $_GET['nearlon'] = ($aData[6]=='E'?1:-1) * ($aData[4] + $aData[5]/60); $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.]*)(\\]|$|\\b)/', $sQuery, $aData)) { $_GET['nearlat'] = $aData[2]; $_GET['nearlon'] = $aData[3]; @@ -271,7 +271,8 @@ $aPhrase = $oDB->getRow("select make_standard_name('".pg_escape_string($sPhrase)."') as string"); if (PEAR::isError($aPhrase)) { - var_dump($aPhrase); + echo "Illegal query string (not an UTF-8 string): ".$sPhrase; + if (CONST_Debug) var_dump($aPhrase); exit; } if (trim($aPhrase['string'])) @@ -354,7 +355,7 @@ } } if ($bSuggestion) $sSuggestion = join(', ',$aSuggestion); -/* + // Try and calculate GB postcodes we might be missing foreach($aTokens as $sToken) { @@ -372,14 +373,13 @@ } } } -*/ foreach($aTokens as $sToken) { // Unknown single word token with a number - assume it is a house number if (!isset($aValidTokens[' '.$sToken]) && strpos($sToken,' ') === false && preg_match('/[0-9]/', $sToken)) { - $aValidTokens[' '.$sToken] = array('class'=>'place','type'=>'house'); + $aValidTokens[' '.$sToken] = array(array('class'=>'place','type'=>'house')); } } @@ -1161,7 +1161,7 @@ } // Output data suitable for display (points and a bounding box) - if ($bShowPolygons) + if ($bShowPolygons && isset($aPolyPoints)) { $aResult['aPolyPoints'] = array(); foreach($aPolyPoints as $aPoint)