Skip to content

Commit

Permalink
add trigram index to search (#3719)
Browse files Browse the repository at this point in the history
* add trigram index to search

* add community index
  • Loading branch information
phiresky authored and Nutomic committed Jul 27, 2023
1 parent f667679 commit 6dee7d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions migrations/2023-07-24-232635_trigram-index/down.sql
@@ -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;

10 changes: 10 additions & 0 deletions migrations/2023-07-24-232635_trigram-index/up.sql
@@ -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);

0 comments on commit 6dee7d1

Please sign in to comment.