diff options
author | dakkar <dakkar@thenautilus.net> | 2023-09-17 12:50:41 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2023-09-17 12:50:41 +0100 |
commit | f648e3cf2e63a50dcf02512c6c0ec702e00b2242 (patch) | |
tree | 566cc8f8f22b50b97b355120dbdd88e8c6558b15 /lib/Dakkar/TweetArchive/Store.pm | |
parent | twitter friends stopped working ages ago (diff) | |
download | tweet-archive-f648e3cf2e63a50dcf02512c6c0ec702e00b2242.tar.gz tweet-archive-f648e3cf2e63a50dcf02512c6c0ec702e00b2242.tar.bz2 tweet-archive-f648e3cf2e63a50dcf02512c6c0ec702e00b2242.zip |
fix fts for notes
in case of renotes without comments, the top-level text is null, so
nothing got indexed
Diffstat (limited to 'lib/Dakkar/TweetArchive/Store.pm')
-rw-r--r-- | lib/Dakkar/TweetArchive/Store.pm | 21 |
1 files changed, 21 insertions, 0 deletions
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; |