mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Speeding up the search for tags.
This commit is contained in:
parent
680524f446
commit
1b0b686116
2 changed files with 25 additions and 17 deletions
|
@ -144,6 +144,8 @@ function search_content(&$a) {
|
|||
$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d group by `item`.`uri` ",
|
||||
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
|
||||
$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
|
||||
$sql_order = "`term`.`tid`";
|
||||
//$sql_order = "`item`.`received`";
|
||||
|
||||
//$sql_extra = sprintf(" AND EXISTS (SELECT * FROM `term` WHERE `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d) GROUP BY `item`.`uri` ",
|
||||
// dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
|
||||
|
@ -155,6 +157,7 @@ function search_content(&$a) {
|
|||
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||
}
|
||||
$sql_table = "`item`";
|
||||
$sql_order = "`item`.`received`";
|
||||
}
|
||||
|
||||
// Here is the way permissions work in the search module...
|
||||
|
@ -195,7 +198,7 @@ function search_content(&$a) {
|
|||
OR ( `item`.`uid` = %d ))
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra
|
||||
ORDER BY `received` DESC LIMIT %d , %d ",
|
||||
ORDER BY $sql_order DESC LIMIT %d , %d ",
|
||||
intval(local_user()),
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
|
@ -209,7 +212,7 @@ function search_content(&$a) {
|
|||
}
|
||||
|
||||
|
||||
if($tag)
|
||||
if($tag)
|
||||
$o .= '<h2>Items tagged with: ' . $search . '</h2>';
|
||||
else
|
||||
$o .= '<h2>Search results for: ' . $search . '</h2>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue