]> git.mxchange.org Git - friendica.git/commitdiff
shared tag search
authorFriendika <info@friendika.com>
Mon, 24 Oct 2011 04:37:11 +0000 (21:37 -0700)
committerFriendika <info@friendika.com>
Mon, 24 Oct 2011 04:37:11 +0000 (21:37 -0700)
mod/search.php

index 2a8bf1484ec3e62495ee7a1bc4969635d4e48800..e2c365fd3ace99bbff38ebb5475db0411e70e265 100644 (file)
@@ -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
 
        // 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`
                $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 ",
                        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))
        );
 
        if(count($r))
@@ -137,7 +139,6 @@ function search_content(&$a) {
                $search_alg
                ORDER BY `received` DESC LIMIT %d , %d ",
                intval(local_user()),
                $search_alg
                ORDER BY `received` DESC LIMIT %d , %d ",
                intval(local_user()),
-               dbesc($search),
                intval($a->pager['start']),
                intval($a->pager['itemspage'])
 
                intval($a->pager['start']),
                intval($a->pager['itemspage'])