]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
"display list of status items" moved to include/conversation.php,
[friendica.git] / mod / search.php
index 64281dfcfb371e448eac7abefb00c0669526ee17..b53bd45c0adaae294f5a699a289184b11742ed0f 100644 (file)
@@ -36,12 +36,20 @@ function search_content(&$a) {
                AND `item`.`deny_gid`  = '' 
        ";
 
+       $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
+               $search_alg = $s_regx;
+
        $r = q("SELECT COUNT(*) AS `total`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
                AND ( `wall` = 1 OR `contact`.`uid` = %d )
                AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
-               AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )
+               $search_alg
                $sql_extra ",
                intval(local_user()),
                dbesc($search)
@@ -65,7 +73,7 @@ function search_content(&$a) {
                WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
                AND ( `wall` = 1 OR `contact`.`uid` = %d )
                AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
-               AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )
+               $search_alg
                $sql_extra
                ORDER BY `parent` DESC ",
                intval(local_user()),