mirror of
https://github.com/friendica/friendica
synced 2025-04-26 17:10:10 +00:00
All subqueries in tag searches are now reformed. Further SQL improvements
This commit is contained in:
parent
759015e5fd
commit
eaefcf9de7
5 changed files with 57 additions and 38 deletions
|
@ -168,7 +168,7 @@ function network_init(&$a) {
|
|||
}
|
||||
}
|
||||
if(x($_GET,'remove')) {
|
||||
q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
|
||||
q("delete from `search` where `uid` = %d and `term` = '%s'",
|
||||
intval(local_user()),
|
||||
dbesc($search)
|
||||
);
|
||||
|
@ -675,11 +675,18 @@ function network_content(&$a, $update = 0) {
|
|||
}*/
|
||||
|
||||
if($tag) {
|
||||
$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
|
||||
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_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
|
||||
// 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 = "`term`.`tid`";
|
||||
|
||||
$sql_extra = "";
|
||||
|
||||
$sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
|
||||
dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval(local_user()));
|
||||
|
||||
$sql_order = "`item`.`received`";
|
||||
} else {
|
||||
if (get_config('system','use_fulltext_engine'))
|
||||
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue