diff --git a/server/migrations/20250117225159_strip-html-index.down.sql b/server/migrations/20250117225159_strip-html-index.down.sql new file mode 100644 index 0000000..4b01805 --- /dev/null +++ b/server/migrations/20250117225159_strip-html-index.down.sql @@ -0,0 +1,5 @@ +-- Add down migration script here +DROP INDEX post_summary_idx; +CREATE INDEX post_summary_idx ON post USING gin ( + to_tsvector('english', summary) +); diff --git a/server/migrations/20250117225159_strip-html-index.up.sql b/server/migrations/20250117225159_strip-html-index.up.sql new file mode 100644 index 0000000..4e99e01 --- /dev/null +++ b/server/migrations/20250117225159_strip-html-index.up.sql @@ -0,0 +1,11 @@ +-- Something like this around summary in the idx w/ tsvector +DROP INDEX post_summary_idx; +CREATE INDEX post_summary_idx ON post USING gin (to_tsvector( + 'english', + regexp_replace( + regexp_replace(summary, '<[^>]+>', ' ', 'g'), + '\s+', + ' ', + 'g' + ) +));