From e397caa82adb689a279e605bf17b852552105e11 Mon Sep 17 00:00:00 2001 From: zeed Date: Sun, 14 Apr 2019 06:01:09 +0000 Subject: [PATCH] update the tsvector_combined when create_published_article https://discourse.tt-rss.org/t/create-published-article-doesnt-update-the-tsvector-combined/2277 --- classes/article.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/classes/article.php b/classes/article.php index ff83143d6..d6387107a 100755 --- a/classes/article.php +++ b/classes/article.php @@ -151,6 +151,16 @@ class Article extends Handler_Protected { content = ?, content_hash = ? WHERE id = ?"); $sth->execute([$content, $content_hash, $ref_id]); + if (DB_TYPE == "pgsql"){ + $sth = $pdo->prepare("UPDATE ttrss_entries + SET tsvector_combined = to_tsvector( :ts_content) + WHERE id = :id"); + $params = [ + ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), + ":id" => $ref_id]; + $sth->execute($params); + } + $sth = $pdo->prepare("UPDATE ttrss_user_entries SET published = true, last_published = NOW() WHERE int_id = ? AND owner_uid = ?"); @@ -186,7 +196,15 @@ class Article extends Handler_Protected { if ($row = $sth->fetch()) { $ref_id = $row["id"]; - + if (DB_TYPE == "pgsql"){ + $sth = $pdo->prepare("UPDATE ttrss_entries + SET tsvector_combined = to_tsvector( :ts_content) + WHERE id = :id"); + $params = [ + ":ts_content" => mb_substr(strip_tags($content ), 0, 900000), + ":id" => $ref_id]; + $sth->execute($params); + } $sth = $pdo->prepare("INSERT INTO ttrss_user_entries (ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache, last_read, note, unread, last_published)