git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-636
================================================================================
+VERSION 0.9.7 07 May 2004
+
+New :
+
+ * Search :
+ - Nickname are used in fast search. -Car
+
+================================================================================
VERSION 0.9.6 07 May 2004
New :
ini_set('memory_limit', "16M");
$globals->xdb->execute('DELETE FROM search_name');
-$res = $globals->xdb->iterRow('SELECT user_id, nom, prenom, nom_usage FROM auth_user_md5');
+$res = $globals->xdb->iterRow('SELECT auth_user_md5.user_id, nom, prenom, nom_usage, profile_nick FROM auth_user_md5 INNER JOIN auth_user_quick USING(user_id)');
$i = 0;
+$muls = array(1,1,1,0.2);
while ($tmp = $res->next()) {
$uid = array_shift($tmp);
- _user_reindex($uid, $tmp);
+ _user_reindex($uid, $tmp, $muls);
printf ("%02.2f %%\n", ++$i*100/$res->total());
}
$nom_anc = $nom;
$prenom_anc = $prenom;
$nationalite_anc = $nationalite;
+$nickname_anc = $nickname;
replace_ifset($nom,'nom');
replace_ifset($prenom,'prenom');
$freetext, $freetext_pub,
Session::getInt('uid', -1));
+if ($nickname != $nickname_anc) {
+ require_once('user.func.inc.php');
+ user_reindex(Session::getInt('uid', -1));
+}
$globals->xdb->execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, Session::getInt('uid', -1));
// vim:set et sws=4 sts=4 sw=4:
?>
// }}}
// {{{ function _user_reindex
-function _user_reindex($uid, $keys) {
+function _user_reindex($uid, $keys, $muls) {
global $globals;
- foreach ($keys as $key) {
+ foreach ($keys as $i => $key) {
if ($key == '') {
continue;
}
$first = 5;
while ($toks) {
$token = strtolower(replace_accent(array_pop($toks) . $token));
- $score = ($toks ? 0 : 10 + $first);
+ $score = ($toks ? 0 : 10 + $first) * $muls[$i];
mysql_query("REPLACE INTO search_name (token, uid, score) VALUES('$token',$uid,$score)");
$first = 0;
}
function user_reindex($uid) {
global $globals;
$globals->xdb->execute("DELETE FROM search_name WHERE uid={?}", $uid);
- $res = $globals->xdb->query("SELECT prenom, nom, nom_usage FROM auth_user_md5 WHERE user_id = {?}", $uid);
- _user_reindex($uid, $res->fetchOneRow());
+ $res = $globals->xdb->query("SELECT prenom, nom, nom_usage, profile_nick FROM auth_user_md5 INNER JOIN auth_user_quick USING(user_id) WHERE auth_user_md5.user_id = {?}", $uid);
+ _user_reindex($uid, $res->fetchOneRow(), array(1,1,1,0.2));
}
// }}}
--- /dev/null
+#!/bin/bash
+
+. ../inc/pervasive.sh
+
+mailman_stop
+mailman_templates
+mailman_start
+
+
+###########################################################
+for sql in *.sql
+do
+ echo -n $sql
+ $MYSQL x4dat < $sql &>/dev/null || echo -n " ERROR"
+ echo .
+done
+
+###########################################################
+
+echo "we will now upgrade the search table (this may be a long operation)
+
+please hit ^D to continue
+"
+
+cat
+
+pushd ../../bin
+./search.rebuild_db.php
+popd
+
+###########################################################
+