Issue 9584: Only search posts from federated networks
This commit is contained in:
parent
67573cf996
commit
c3d0ab56a5
3 changed files with 16 additions and 5 deletions
|
@ -42,7 +42,9 @@ class ItemContent
|
||||||
public static function getURIIdListBySearch(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0)
|
public static function getURIIdListBySearch(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0)
|
||||||
{
|
{
|
||||||
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `item-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE))
|
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `item-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE))
|
||||||
AND (NOT `private` OR (`private` AND `uid` = ?))", $search, $uid];
|
AND (NOT `private` OR (`private` AND `uid` = ?))
|
||||||
|
AND `uri-id` IN (SELECT `uri-id` FROM `item` WHERE `network` IN (?, ?, ?, ?))",
|
||||||
|
$search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||||
|
|
||||||
if (!empty($last_uriid)) {
|
if (!empty($last_uriid)) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]);
|
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]);
|
||||||
|
@ -68,7 +70,9 @@ class ItemContent
|
||||||
public static function countBySearch(string $search, int $uid = 0)
|
public static function countBySearch(string $search, int $uid = 0)
|
||||||
{
|
{
|
||||||
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `item-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE))
|
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `item-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE))
|
||||||
AND (NOT `private` OR (`private` AND `uid` = ?))", $search, $uid];
|
AND (NOT `private` OR (`private` AND `uid` = ?))
|
||||||
|
AND `uri-id` IN (SELECT `uri-id` FROM `item` WHERE `network` IN (?, ?, ?, ?))",
|
||||||
|
$search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||||
return DBA::count('item', $condition);
|
return DBA::count('item', $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Model;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\Cache\Duration;
|
use Friendica\Core\Cache\Duration;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
@ -450,7 +451,9 @@ class Tag
|
||||||
*/
|
*/
|
||||||
public static function countByTag(string $search, int $uid = 0)
|
public static function countByTag(string $search, int $uid = 0)
|
||||||
{
|
{
|
||||||
$condition = ["`name` = ? AND (NOT `private` OR (`private` AND `uid` = ?))", $search, $uid];
|
$condition = ["`name` = ? AND (NOT `private` OR (`private` AND `uid` = ?))
|
||||||
|
AND `uri-id` IN (SELECT `uri-id` FROM `item` WHERE `network` IN (?, ?, ?, ?))",
|
||||||
|
$search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||||
$params = ['group_by' => ['uri-id']];
|
$params = ['group_by' => ['uri-id']];
|
||||||
|
|
||||||
return DBA::count('tag-search-view', $condition, $params);
|
return DBA::count('tag-search-view', $condition, $params);
|
||||||
|
@ -468,7 +471,9 @@ class Tag
|
||||||
*/
|
*/
|
||||||
public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0)
|
public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0)
|
||||||
{
|
{
|
||||||
$condition = ["`name` = ? AND (NOT `private` OR (`private` AND `uid` = ?))", $search, $uid];
|
$condition = ["`name` = ? AND (NOT `private` OR (`private` AND `uid` = ?))
|
||||||
|
AND `uri-id` IN (SELECT `uri-id` FROM `item` WHERE `network` IN (?, ?, ?, ?))",
|
||||||
|
$search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
|
||||||
|
|
||||||
if (!empty($last_uriid)) {
|
if (!empty($last_uriid)) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]);
|
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]);
|
||||||
|
|
|
@ -175,7 +175,9 @@ class Index extends BaseSearch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($items)) {
|
if (empty($items)) {
|
||||||
|
if (empty($last_uriid)) {
|
||||||
notice(DI::l10n()->t('No results.'));
|
notice(DI::l10n()->t('No results.'));
|
||||||
|
}
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue