X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/cb40aa41d5b0efefdb2b9263e87ed016cce96277..1427753846915d3d69e1ff7df9cfa71929e2bb9c:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index 1d232062..acd3a5f2 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -24,7 +24,14 @@ $aLoadAverage = explode(' ',$sLoadAverage); return (int)$aLoadAverage[0]; } - + + function getProcessorCount() + { + $sCPU = file_get_contents('/proc/cpuinfo'); + preg_match_all('#processor : [0-9]+#', $sCPU, $aMatches); + return sizeof($aMatches[0]); + } + function bySearchRank($a, $b) { if ($a['iSearchRank'] == $b['iSearchRank']) return 0; @@ -49,7 +56,7 @@ { $_SERVER["HTTP_ACCEPT_LANGUAGE"] = $_GET['accept-language']; } - + $aLanguages = array(); if (preg_match_all('/(([a-z]{1,8})(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $aLanguagesParse, PREG_SET_ORDER)) { @@ -690,12 +697,8 @@ $sSQL .= " length(name::text) as namelength "; $sSQL .= " from place_addressline join placex on (address_place_id = placex.place_id)"; $sSQL .= " where place_addressline.place_id = $iPlaceID and (rank_address > 0 OR address_place_id = $iPlaceID)"; -// and isaddress"; - if ($sCountryCode) - { - $sSQL .= " and (placex.country_code IS NULL OR placex.country_code = '".$sCountryCode."' OR rank_address < 4)"; - } - $sSQL .= " order by cached_rank_address desc,fromarea desc,distance asc,rank_search desc,namelength desc"; + $sSQL .= " order by cached_rank_address desc,isaddress desc,fromarea desc,distance asc,rank_search desc,namelength +desc"; //var_dump($sSQL); $aAddressLines = $oDB->getAll($sSQL); if (PEAR::IsError($aAddressLines))