Skip to content

Commit

Permalink
Optimize fulltext queries
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuchal committed Dec 6, 2023
1 parent c74a431 commit e998772
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions db/migrate/20231206200814_optimize_fulltext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class OptimizeFulltext < ActiveRecord::Migration[7.1]
def change
add_index :searchable_message_threads, %[(((to_tsvector('simple'::regconfig, COALESCE(title, ''::text)) || to_tsvector('simple'::regconfig, COALESCE(content, ''::text))) || to_tsvector('simple'::regconfig, COALESCE((note)::text, ''::text))) || to_tsvector('simple'::regconfig, COALESCE(tag_names, ''::text)))], using: :gin, name: :idx_searchable_message_threads_fulltext
add_index :searchable_message_threads, ["id", "box_id", "last_message_delivered_at"], unique: true
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e998772

Please sign in to comment.