From 1dfb0ce81cd8e4b9cebe8bdd368ef06fbe6bd79c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 15 Nov 2023 17:55:45 +0000 Subject: [PATCH] "test" is renamed to "check", documentation for platform added --- database.sql | 8 ++++---- doc/Channels.md | 1 + doc/database.md | 2 +- doc/database/db_test-full-text-search.md | 4 ++-- .../Conversation/Repository/UserDefinedChannel.php | 6 +++--- src/Worker/OptimizeTables.php | 2 +- static/dbstructure.config.php | 6 +++--- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/database.sql b/database.sql index 39a56e7966..86f8e82eb5 100644 --- a/database.sql +++ b/database.sql @@ -1868,14 +1868,14 @@ CREATE TABLE IF NOT EXISTS `subscription` ( ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Push Subscription for the API'; -- --- TABLE test-full-text-search +-- TABLE check-full-text-search -- -CREATE TABLE IF NOT EXISTS `test-full-text-search` ( - `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker', +CREATE TABLE IF NOT EXISTS `check-full-text-search` ( + `pid` int unsigned NOT NULL COMMENT 'The ID of the process', `searchtext` mediumtext COMMENT 'Simplified text for the full text search', PRIMARY KEY(`pid`), FULLTEXT INDEX `searchtext` (`searchtext`) -) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Test for a full text search match in user defined channels before storing the message in the system'; +) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Check for a full text search match in user defined channels before storing the message in the system'; -- -- TABLE userd diff --git a/doc/Channels.md b/doc/Channels.md index 260b962942..091b53930d 100644 --- a/doc/Channels.md +++ b/doc/Channels.md @@ -68,6 +68,7 @@ Additionally to the search for content, there are additional keywords that can b * network:dscs - Posts that are received by the Discourse connector. * network:tmbl - Posts that are received by the Tumblr connector. * network:bsky - Posts that are received by the Bluesky connector. +* platform - Use this to include or exclude some platforms from your channel, e.g. "+platform:friendica". * visibility - You have the choice between different visibilities. You can only see unlisted or private posts that you have the access for. * visibility:public * visibility:unlisted diff --git a/doc/database.md b/doc/database.md index 0ed116bc73..26519ccfb4 100644 --- a/doc/database.md +++ b/doc/database.md @@ -18,6 +18,7 @@ Database Tables | [attach](help/database/db_attach) | file attachments | | [cache](help/database/db_cache) | Stores temporary data | | [channel](help/database/db_channel) | User defined Channels | +| [check-full-text-search](help/database/db_check-full-text-search) | Check for a full text search match in user defined channels before storing the message in the system | | [config](help/database/db_config) | main configuration storage | | [contact](help/database/db_contact) | contact table | | [contact-relation](help/database/db_contact-relation) | Contact relations | @@ -86,7 +87,6 @@ Database Tables | [storage](help/database/db_storage) | Data stored by Database storage backend | | [subscription](help/database/db_subscription) | Push Subscription for the API | | [tag](help/database/db_tag) | tags and mentions | -| [test-full-text-search](help/database/db_test-full-text-search) | Test for a full text search match in user defined channels before storing the message in the system | | [user](help/database/db_user) | The local users | | [user-contact](help/database/db_user-contact) | User specific public contact data | | [user-gserver](help/database/db_user-gserver) | User settings about remote servers | diff --git a/doc/database/db_test-full-text-search.md b/doc/database/db_test-full-text-search.md index b6b9bd19e9..e9bdbec353 100644 --- a/doc/database/db_test-full-text-search.md +++ b/doc/database/db_test-full-text-search.md @@ -1,7 +1,7 @@ -Table test-full-text-search +Table check-full-text-search =========== -Test for a full text search match in user defined channels before storing the message in the system +Check for a full text search match in user defined channels before storing the message in the system Fields ------ diff --git a/src/Content/Conversation/Repository/UserDefinedChannel.php b/src/Content/Conversation/Repository/UserDefinedChannel.php index a414f83c25..db7160ac87 100644 --- a/src/Content/Conversation/Repository/UserDefinedChannel.php +++ b/src/Content/Conversation/Repository/UserDefinedChannel.php @@ -154,14 +154,14 @@ class UserDefinedChannel extends \Friendica\BaseRepository } $store = false; - $this->db->insert('test-full-text-search', ['pid' => getmypid(), 'searchtext' => $searchtext], Database::INSERT_UPDATE); + $this->db->insert('check-full-text-search', ['pid' => getmypid(), 'searchtext' => $searchtext], Database::INSERT_UPDATE); $channels = $this->db->select(self::$table_name, ['full-text-search', 'uid', 'label'], ["`full-text-search` != ?", '']); while ($channel = $this->db->fetch($channels)) { $channelsearchtext = $channel['full-text-search']; foreach (['from', 'to', 'group', 'tag', 'network', 'platform', 'visibility'] as $keyword) { $channelsearchtext = preg_replace('~(' . $keyword . ':.[\w@\.-]+)~', '"$1"', $channelsearchtext); } - if ($this->db->exists('test-full-text-search', ["`pid` = ? AND MATCH (`searchtext`) AGAINST (? IN BOOLEAN MODE)", getmypid(), $channelsearchtext])) { + if ($this->db->exists('check-full-text-search', ["`pid` = ? AND MATCH (`searchtext`) AGAINST (? IN BOOLEAN MODE)", getmypid(), $channelsearchtext])) { if (in_array($language, $this->pConfig->get($channel['uid'], 'channel', 'languages', [User::getLanguageCode($channel['uid'])]))) { $store = true; $this->logger->debug('Matching channel found.', ['uid' => $channel['uid'], 'label' => $channel['label'], 'language' => $language, 'channelsearchtext' => $channelsearchtext, 'searchtext' => $searchtext]); @@ -171,7 +171,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository } $this->db->close($channels); - $this->db->delete('test-full-text-search', ['pid' => getmypid()]); + $this->db->delete('check-full-text-search', ['pid' => getmypid()]); return $store; } } diff --git a/src/Worker/OptimizeTables.php b/src/Worker/OptimizeTables.php index db525fce2b..50f9341d72 100644 --- a/src/Worker/OptimizeTables.php +++ b/src/Worker/OptimizeTables.php @@ -46,7 +46,7 @@ class OptimizeTables DBA::optimizeTable('parsed_url'); DBA::optimizeTable('session'); DBA::optimizeTable('post-engagement'); - DBA::optimizeTable('test-full-text-search'); + DBA::optimizeTable('check-full-text-search'); if (DI::config()->get('system', 'optimize_all_tables')) { DBA::optimizeTable('apcontact'); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 1e72868860..be16270ca2 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -1858,10 +1858,10 @@ return [ "uid_application-id" => ["uid", "application-id"], ] ], - "test-full-text-search" => [ - "comment" => "Test for a full text search match in user defined channels before storing the message in the system", + "check-full-text-search" => [ + "comment" => "Check for a full text search match in user defined channels before storing the message in the system", "fields" => [ - "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"], + "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => "The ID of the process"], "searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"], ], "indexes" => [