diff options
author | Friendika <info@friendika.com> | 2011-10-23 21:37:11 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-23 21:37:11 -0700 |
commit | 87aedacec77025c8d1474d26b364be6ba58e1192 (patch) | |
tree | 77265ae520e268be154cc36d16409d1fdfb32d43 | |
parent | fe2c8a18454253df09f20c8821d7d6e14c0ea8e0 (diff) | |
download | volse-hubzilla-87aedacec77025c8d1474d26b364be6ba58e1192.tar.gz volse-hubzilla-87aedacec77025c8d1474d26b364be6ba58e1192.tar.bz2 volse-hubzilla-87aedacec77025c8d1474d26b364be6ba58e1192.zip |
shared tag search
-rw-r--r-- | mod/search.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/mod/search.php b/mod/search.php index 2a8bf1484..e2c365fd3 100644 --- a/mod/search.php +++ b/mod/search.php @@ -96,12 +96,15 @@ function search_content(&$a) { // Only public wall posts can be shown // OR your own posts if you are a logged in member - $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )"; - $s_regx = "AND `item`.`body` REGEXP '%s' "; - if(mb_strlen($search) >= 3) - $search_alg = $s_bool; - else +// $s_bool = sprintf("AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )", dbesc($search)); + $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", + dbesc($search), dbesc('\\]' . $search . '\\[')); + +// if(mb_strlen($search) >= 3) +// $search_alg = $s_bool; +// else + $search_alg = $s_regx; $r = q("SELECT COUNT(*) AS `total` @@ -111,8 +114,7 @@ function search_content(&$a) { OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $search_alg ", - intval(local_user()), - dbesc($search) + intval(local_user()) ); if(count($r)) @@ -137,7 +139,6 @@ function search_content(&$a) { $search_alg ORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), - dbesc($search), intval($a->pager['start']), intval($a->pager['itemspage']) |