add trigram index to search (#3719)

* add trigram index to search

* add community index
This commit is contained in:
phiresky 2023-07-27 12:11:00 +02:00 committed by GitHub
parent 3471f3533c
commit 9bfa86d162
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,8 @@
DROP INDEX idx_comment_content_trigram;
DROP INDEX idx_post_trigram;
DROP INDEX idx_person_trigram;
DROP INDEX idx_community_trigram;

View file

@ -0,0 +1,10 @@
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX IF NOT EXISTS idx_comment_content_trigram ON comment USING gin(content gin_trgm_ops);
CREATE INDEX IF NOT EXISTS idx_post_trigram ON post USING gin(name gin_trgm_ops, body gin_trgm_ops);
CREATE INDEX IF NOT EXISTS idx_person_trigram ON person USING gin(name gin_trgm_ops, display_name gin_trgm_ops);
CREATE INDEX IF NOT EXISTS idx_community_trigram ON community USING gin(name gin_trgm_ops, title gin_trgm_ops);