]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / search.php
index d2251ce584a7ac4b1f3ec387b10ac8dbde2dcc4f..91c2ff31438f767a1679f529381d86ea4b4325b7 100644 (file)
@@ -15,7 +15,7 @@ function search_saved_searches() {
                intval(local_user())
        );
 
-       if(count($r)) {
+       if(dbm::is_result($r)) {
                $saved = array();
                foreach($r as $rr) {
                        $saved[] = array(
@@ -53,7 +53,7 @@ function search_init(&$a) {
                                intval(local_user()),
                                dbesc($search)
                        );
-                       if(! count($r)) {
+                       if(! dbm::is_result($r)) {
                                q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')",
                                        intval(local_user()),
                                        dbesc($search)
@@ -191,9 +191,9 @@ function search_content(&$a) {
        if($tag) {
                logger("Start tag search for '".$search."'", LOGGER_DEBUG);
 
-               $r = q("SELECT STRAIGHT_JOIN %s
+               $r = q("SELECT %s
                        FROM `term`
-                               INNER JOIN `item` ON `item`.`id`=`term`.`oid` %s
+                               STRAIGHT_JOIN `item` ON `item`.`id`=`term`.`oid` %s
                        WHERE %s AND (`term`.`uid` = 0 OR (`term`.`uid` = %d AND NOT `term`.`global`)) AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s'
                        ORDER BY term.created DESC LIMIT %d , %d ",
                                item_fieldlists(), item_joins(), item_condition(),
@@ -209,7 +209,8 @@ function search_content(&$a) {
                        $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
                }
 
-               $r = q("SELECT STRAIGHT_JOIN %s
+
+               $r = q("SELECT %s
                        FROM `item` %s
                        WHERE %s AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`))
                                $sql_extra
@@ -219,7 +220,7 @@ function search_content(&$a) {
                                intval($a->pager['start']), intval($a->pager['itemspage']));
        }
 
-       if(! count($r)) {
+       if(! dbm::is_result($r)) {
                info( t('No results.') . EOL);
                return $o;
        }