aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Search.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
committerzotlabs <mike@macgirvin.com>2018-02-05 15:58:28 -0800
commitb41c5f349715abc6ca7db563e3938336bc75974e (patch)
tree31a1ee5a74227c30239bb9d2a10341bbacb8ecec /Zotlabs/Module/Search.php
parent05de59d4ad174cb106c3a5b5890732af51730384 (diff)
parent930e1fdbdc798868760f8a4e03f32fc3f42e8bc9 (diff)
downloadvolse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.gz
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.tar.bz2
volse-hubzilla-b41c5f349715abc6ca7db563e3938336bc75974e.zip
Merge branch 'master' into z6
Diffstat (limited to 'Zotlabs/Module/Search.php')
-rw-r--r--Zotlabs/Module/Search.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index a572a5a42..4d35b59f3 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -165,40 +165,41 @@ class Search extends \Zotlabs\Web\Controller {
if($load) {
$r = null;
- if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $prefix = 'distinct on (created, mid)';
- $suffix = 'ORDER BY created DESC, mid';
- } else {
- $prefix = 'distinct';
- $suffix = 'group by mid ORDER BY created DESC';
- }
if(local_channel()) {
- $r = q("SELECT $prefix mid, item.id as item_id, item.* from item
+ $r = q("SELECT mid, MAX(id) as item_id from item
WHERE ((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 )
OR ( item.uid = %d )) OR item.owner_xchan = '%s' )
$item_normal
$sql_extra
- $suffix $pager_sql ",
+ group by mid order by created desc $pager_sql ",
intval(local_channel()),
dbesc($sys['xchan_hash'])
);
}
if($r === null) {
- $r = q("SELECT $prefix mid, item.id as item_id, item.* from item
+ $r = q("SELECT mid, MAX(id) as item_id from item
WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
AND item.deny_gid = '' AND item_private = 0 )
and owner_xchan in ( " . stream_perms_xchans(($observer) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
$pub_sql ) OR owner_xchan = '%s')
$item_normal
$sql_extra
- $suffix $pager_sql",
+ group by mid order by created desc $pager_sql",
dbesc($sys['xchan_hash'])
);
}
+ if($r) {
+ $str = ids_to_querystr($r,'item_id');
+ $r = q("select *, id as item_id from item where id in ( " . $str . ") order by created desc ");
+ }
}
else {
$r = array();
}
+
+
+
+
}
if($r) {