From 6dbb167ed2c2a2c97f4bdd04e596de0e8dba74ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 2 Mar 2010 11:05:42 +0100 Subject: [PATCH] Renames uid to pid in search_name table. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/profile.php | 6 +++--- modules/search/classes.inc.php | 2 +- modules/search/search.inc.php | 6 +++--- upgrade/account/20_naming_convention.sql | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/classes/profile.php b/classes/profile.php index f46eb15..79372e7 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -606,7 +606,7 @@ class Profile public static function rebuildSearchTokens($pid) { XDB::execute('DELETE FROM search_name - WHERE uid = {?}', + WHERE pid = {?}', $pid); $keys = XDB::iterator("SELECT CONCAT(n.particle, n.name) AS name, e.score, FIND_IN_SET('public', e.flags) AS public @@ -625,9 +625,9 @@ class Profile while ($toks) { $token = strtolower(replace_accent(array_pop($toks) . $token)); $score = ($toks ? 0 : 10 + $first) * ($key['score'] / 10); - XDB::execute('REPLACE INTO search_name (token, uid, soundex, score, flags) + XDB::execute('REPLACE INTO search_name (token, pid, soundex, score, flags) VALUES ({?}, {?}, {?}, {?}, {?})', - $token, $uid, soundex_fr($token), $score, $key['public']); + $token, $pid, soundex_fr($token), $score, $key['public']); $first = 0; } } diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index c23d1c7..eb15e54 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -372,7 +372,7 @@ class QuickSearch extends SField $and = "AND FIND_IN_SET('public', sn$i.flags)"; } $myu = str_replace('snv', "sn$i", $uniq); - $join .= "INNER JOIN search_name AS sn$i ON (u.user_id = sn$i.uid $and$myu)\n"; + $join .= "INNER JOIN search_name AS sn$i ON (u.user_id = sn$i.pid $and$myu)\n"; $uniq .= " AND sn$i.token != snv.token"; } if (!empty($this->email)) { diff --git a/modules/search/search.inc.php b/modules/search/search.inc.php index 1d73a17..8506dbd 100644 --- a/modules/search/search.inc.php +++ b/modules/search/search.inc.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once dirname(__FILE__).'/classes.inc.php'; +require_once dirname(__FILE__) . '/classes.inc.php'; // {{{ function advancedSearchFromInput function getAddressJoin($table) { @@ -29,9 +29,9 @@ function advancedSearchFromInput() { if ($with_soundex = Env::has('with_soundex')) { $nameField = new RefWithSoundexSField('name', array('n.soundex'), 'search_name', - 'n', 'u.user_id = n.uid'); + 'n', 'u.user_id = n.pid'); } else { - $nameField = new NameSField('name', array('n.token'), 'search_name', 'n', 'u.user_id = n.uid'); + $nameField = new NameSField('name', array('n.token'), 'search_name', 'n', 'u.user_id = n.pid'); } $promo1Field = new PromoSField('promo1', 'egal1', array('u.promo'), ''); diff --git a/upgrade/account/20_naming_convention.sql b/upgrade/account/20_naming_convention.sql index a1946ae..bc8a3cc 100644 --- a/upgrade/account/20_naming_convention.sql +++ b/upgrade/account/20_naming_convention.sql @@ -60,4 +60,8 @@ CHANGE COLUMN user_id uid INT(11) NOT NULL; ALTER TABLE watch_profile CHANGE COLUMN uid pid INT(11) NOT NULL; +# search_name + ALTER TABLE search_name +CHANGE COLUMN uid pid INT(11) NOT NULL; + # vim:set ft=mysql: -- 2.1.4