From f648e3cf2e63a50dcf02512c6c0ec702e00b2242 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 17 Sep 2023 12:50:41 +0100 Subject: fix fts for notes in case of renotes without comments, the top-level text is null, so nothing got indexed --- lib/Dakkar/TweetArchive/Store.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Dakkar/TweetArchive/Store.pm b/lib/Dakkar/TweetArchive/Store.pm index 1b926d5..7cf43c7 100644 --- a/lib/Dakkar/TweetArchive/Store.pm +++ b/lib/Dakkar/TweetArchive/Store.pm @@ -548,4 +548,25 @@ CREATE TABLE misskey_following ( SQL } +sub _schema_deploy_7($self) { + my $dbh = $self->dbh; + + $dbh->do(<<'SQL'); +CREATE OR REPLACE FUNCTION note_text_recursive(IN t JSONB) RETURNS text +LANGUAGE sql +IMMUTABLE +RETURNS NULL ON NULL INPUT +PARALLEL SAFE +AS $$ SELECT +COALESCE( note_text(t), '') || ' ' || +COALESCE( note_text_recursive(t->'renote'), '') +$$; +SQL + + $dbh->do(<<'SQL'); +UPDATE notes +SET fts = to_tsvector(note_language(data),note_text_recursive(data)); +SQL +} + 1; -- cgit v1.2.3