From: Michael Date: Wed, 10 Jan 2024 10:55:18 +0000 (+0000) Subject: Language check added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df3028f87dd63f207e827b73ec50937b93f745f1;p=friendica.git Language check added --- diff --git a/src/Content/Conversation/Repository/UserDefinedChannel.php b/src/Content/Conversation/Repository/UserDefinedChannel.php index e03b28ee89..e7b32255fe 100644 --- a/src/Content/Conversation/Repository/UserDefinedChannel.php +++ b/src/Content/Conversation/Repository/UserDefinedChannel.php @@ -151,7 +151,8 @@ class UserDefinedChannel extends \Friendica\BaseRepository /** * Checks, if one of the user defined channels matches with the given search text - * @todo To increase the performance, this functionality should be replaced with a single SQL call. + * @todo Combine all the full text statements in a single search text to improve the performance. + * Add a "valid" field for the channel that is set when the full text statement doesn't contain errors. * * @param string $searchtext * @param string $language @@ -166,7 +167,18 @@ class UserDefinedChannel extends \Friendica\BaseRepository return []; } - return !empty($this->getMatches($searchtext, $language, $tags, $media_type, 0, 0, array_column($users, 'uid'), false)); + $uids = array_column($users, 'uid'); + + $condition = ['uid' => $uids]; + $condition = DBA::mergeConditions($condition, ["`languages` != ? AND `include-tags` = ? AND `full-text-search` = ? AND circle = ?", '', '', '', 0]); + + foreach ($this->select($condition) as $channel) { + if (!empty($channel->languages) && in_array($language, $channel->languages)) { + return true; + } + } + + return !empty($this->getMatches($searchtext, $language, $tags, $media_type, 0, 0, $uids, false)); } /**