X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fsearch.rebuild_db.php;h=be3453191bb80ac98e232f5c20dadd6b64263016;hb=8526cfe046865202710c548a3a58c7dbddeaee65;hp=81fa957468338bbb099fc5919d0ec40d1afc9cd7;hpb=25fe4c85de79aa601948d788b5754b5b6070080d;p=platal.git diff --git a/bin/search.rebuild_db.php b/bin/search.rebuild_db.php index 81fa957..be34531 100755 --- a/bin/search.rebuild_db.php +++ b/bin/search.rebuild_db.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q debug = 0; // Do not store backtraces - -XDB::execute('DELETE FROM search_name'); -$res = XDB::iterRow('SELECT auth_user_md5.user_id, nom, prenom, nom_usage, profile_nick - FROM auth_user_md5 - LEFT JOIN auth_user_quick USING(user_id)'); +$res = XDB::iterRow('SELECT pid + FROM profiles'); $i = 0; -$muls = array(1, 1, 1, 0.2); -$pub = array(true, true, true, false); -while ($tmp = $res->next()) { - $uid = array_shift($tmp); - _user_reindex($uid, $tmp, $muls, $pub); - printf("\r%u / %u", ++$i, $res->total()); +$n = $res->total(); +$pids = array(); +while ($pid = $res->next()) { + $pids[] = intval($pid[0]); + ++$i; + if (count($pids) == 100) { + Profile::rebuildSearchTokens($pids); + printf("\r%u / %u", $i, $n); + $pids = array(); + } +} +if (count($pids) > 0) { + Profile::rebuildSearchTokens($pids); + printf("\r%u / %u", $i, $n); } print "done\n"; -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>