// Show address breakdown
$bShowAddressDetails = isset($_GET['addressdetails']) && $_GET['addressdetails'];
- // Prefered language
- $aLangPrefOrder = getPrefferedLangauges();
+ // Preferred language
+ $aLangPrefOrder = getPreferredLanguages();
if (isset($aLangPrefOrder['name:de'])) $bReverseInPlan = true;
if (isset($aLangPrefOrder['name:ru'])) $bReverseInPlan = true;
if (isset($aLangPrefOrder['name:ja'])) $bReverseInPlan = true;
}
}
- // Only certain ranks of feature
+ // Only certain ranks of feature
if (isset($_GET['featureType']) && !isset($_GET['featuretype'])) $_GET['featuretype'] = $_GET['featureType'];
if (isset($_GET['featuretype']))
{
$sQuery = substr($_SERVER['PATH_INFO'], 1);
- // reverse order of '/' seperated string
+ // reverse order of '/' separated string
$aPhrases = explode('/', $sQuery);
$aPhrases = array_reverse($aPhrases);
$sQuery = join(', ',$aPhrases);
// Check which tokens we have, get the ID numbers
$sSQL = 'select word_id,word_token, word, class, type, location, country_code, operator';
$sSQL .= ' from word where word_token in ('.join(',',array_map("getDBQuoted",$aTokens)).')';
- $sSQL .= ' and (class is null or class not in (\'highway\'))';
+ // HACK WARNING
+ // (mis)using search_name_count to exclude words that return too many
+ // search results. saerch_name_count is currently set to 1 by hand
+ // because there is no fast way to extract this count from a live database.
+ $sSQL .= ' and search_name_count = 0';
+// $sSQL .= ' and (class is null or class not in (\'highway\'))';
// $sSQL .= ' group by word_token, word, class, type, location, country_code';
if (CONST_Debug) var_Dump($sSQL);
if ($aSearch['sCountryCode'] === false)
{
$aSearch['sCountryCode'] = strtolower($aSearchTerm['country_code']);
- // Country is almost always at the end of the string - increase score for finding it anywhere else (opimisation)
+ // Country is almost always at the end of the string - increase score for finding it anywhere else (optimisation)
if ($iWordset+1 != sizeof($aPhrases[$iPhrase]['wordsets']) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5;
if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
}
$sSQL .= " limit ".$iLimit;
if (CONST_Debug) var_dump($sSQL);
+ $iStartTime = time();
$aViewBoxPlaceIDs = $oDB->getAll($sSQL);
if (PEAR::IsError($aViewBoxPlaceIDs))
{
failInternalError("Could not get places for search terms.", $sSQL, $aViewBoxPlaceIDs);
}
+ if (time() - $iStartTime > 60) {
+ file_put_contents(CONST_BasePath.'/log/long_queries.log', date('Y-m-d H:i:s', $iStartTime).' '.$sSQL."\n", FILE_APPEND);
+ }
+
//var_dump($aViewBoxPlaceIDs);
// Did we have an viewbox matches?
$aPlaceIDs = array();