From c8292b3cddf0a29236cb981111beb4587d7be411 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Dec 2012 03:49:50 -0800 Subject: remove the private keywords stuff to reduce directory and search complexity --- mod/directory.php | 2 +- mod/hcard.php | 2 +- mod/match.php | 6 +++--- mod/msearch.php | 6 +++--- mod/profiles.php | 18 ++++++------------ 5 files changed, 14 insertions(+), 20 deletions(-) (limited to 'mod') diff --git a/mod/directory.php b/mod/directory.php index b320839a7..2ab1db108 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -65,7 +65,7 @@ $localdir = true; if($localdir) { if($search) $search = dbesc($search); - $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, channel.channel_address, `pdesc`, `locality`,`region`,`country_name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); + $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, channel.channel_address, `pdesc`, `locality`,`region`,`country_name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : ""); $r = q("SELECT COUNT(channel_id) AS `total` FROM channel left join profile on channel.channel_id = profile.uid WHERE `is_default` = 1 and not ( channel_pageflags & %d ) $sql_extra ", diff --git a/mod/hcard.php b/mod/hcard.php index 7a2c81c13..cc6d326b5 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -31,7 +31,7 @@ function hcard_init(&$a) { } if(! $blocked) { - $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = ((x($a->profile,'keywords')) ? $a->profile['keywords'] : ''); $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); if(strlen($keywords)) $a->page['htmlhead'] .= '' . "\r\n" ; diff --git a/mod/match.php b/mod/match.php index b845b0d46..32d92cdf3 100644 --- a/mod/match.php +++ b/mod/match.php @@ -11,19 +11,19 @@ function match_content(&$a) { $o .= '

' . t('Profile Match') . '

'; - $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", + $r = q("SELECT `keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) ); if(! count($r)) return; - if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { + if(! $r[0]['keywords']) { notice( t('No keywords to match. Please add keywords to your default profile.') . EOL); return; } $params = array(); - $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); + $tags = trim($r[0]['keywords']; if($tags) { $params['s'] = $tags; diff --git a/mod/msearch.php b/mod/msearch.php index 9d587d1e4..b51c4e097 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -10,13 +10,13 @@ function msearch_post(&$a) { if(! strlen($search)) killme(); - $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ", + $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') ", dbesc($search) ); if(count($r)) $total = $r[0]['total']; - $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ", + $r = q("SELECT `keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') LIMIT %d , %d ", dbesc($search), intval($startrec), intval($perpage) @@ -29,7 +29,7 @@ function msearch_post(&$a) { 'name' => $rr['name'], 'url' => $a->get_baseurl() . '/channel/' . $rr['nickname'], 'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'], - 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['pub_keywords']) + 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords']) ); } diff --git a/mod/profiles.php b/mod/profiles.php index c828941b6..37be9bd08 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -61,8 +61,7 @@ function profiles_post(&$a) { $region = notags(trim($_POST['region'])); $postal_code = notags(trim($_POST['postal_code'])); $country_name = notags(trim($_POST['country_name'])); - $pub_keywords = notags(trim($_POST['pub_keywords'])); - $prv_keywords = notags(trim($_POST['prv_keywords'])); + $keywords = notags(trim($_POST['keywords'])); $marital = notags(trim($_POST['marital'])); $howlong = notags(trim($_POST['howlong'])); $sexual = notags(trim($_POST['sexual'])); @@ -232,8 +231,7 @@ function profiles_post(&$a) { `hometown` = '%s', `politic` = '%s', `religion` = '%s', - `pub_keywords` = '%s', - `prv_keywords` = '%s', + `keywords` = '%s', `likes` = '%s', `dislikes` = '%s', `about` = '%s', @@ -266,8 +264,7 @@ function profiles_post(&$a) { dbesc($hometown), dbesc($politic), dbesc($religion), - dbesc($pub_keywords), - dbesc($prv_keywords), + dbesc($keywords), dbesc($likes), dbesc($dislikes), dbesc($about), @@ -511,13 +508,11 @@ function profiles_content(&$a) { '$lbl_hometown' => t('Hometown:'), '$lbl_politic' => t('Political Views:'), '$lbl_religion' => t('Religious Views:'), - '$lbl_pubkey' => t('Public Keywords:'), - '$lbl_prvkey' => t('Private Keywords:'), + '$lbl_pubkey' => t('Keywords:'), '$lbl_likes' => t('Likes:'), '$lbl_dislikes' => t('Dislikes:'), '$lbl_ex2' => t('Example: fishing photography software'), - '$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"), - '$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"), + '$lbl_pubdsc' => t("Used in directory listings"), '$lbl_about' => t('Tell us about yourself...'), '$lbl_hobbies' => t('Hobbies/Interests'), '$lbl_social' => t('Contact information and Social Networks'), @@ -553,8 +548,7 @@ function profiles_content(&$a) { '$hometown' => $r[0]['hometown'], '$politic' => $r[0]['politic'], '$religion' => $r[0]['religion'], - '$pub_keywords' => $r[0]['pub_keywords'], - '$prv_keywords' => $r[0]['prv_keywords'], + '$keywords' => $r[0]['keywords'], '$likes' => $r[0]['likes'], '$dislikes' => $r[0]['dislikes'], '$music' => $r[0]['music'], -- cgit v1.2.3