From: Michael Vogel Date: Sun, 8 Feb 2015 22:50:45 +0000 (+0100) Subject: Enhanced SQL query so that the search is faster. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c0411ae25a792c100216f651ec784c047e7df7fd;p=friendica.git Enhanced SQL query so that the search is faster. --- diff --git a/mod/search.php b/mod/search.php index d3cf2b1286..338b377e8d 100644 --- a/mod/search.php +++ b/mod/search.php @@ -130,8 +130,8 @@ function search_content(&$a) { if($tag) { $sql_extra = ""; - $sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d) AS `term` ON `item`.`id` = `term`.`oid` ", - dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG)); + $sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` IN (%d, 0)) AS `term` ON `item`.`id` = `term`.`oid` ", + dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user())); $sql_order = "`item`.`id`"; } else {