]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
be a bit efficient about queuing up the places to be indexed
[nominatim.git] / lib / lib.php
index 1d2320627b69188d9e471114b18b4186c0706527..acd3a5f266677fee554e40ab102c8751f417f9e6 100644 (file)
                 $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))
                {
                $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))