add ngram

This commit is contained in:
Pete Matsyburka
2025-06-09 09:55:30 +03:00
parent b6a1a3ee4d
commit 700184f776
6 changed files with 114 additions and 27 deletions
@@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddNgramToSearchIndex < ActiveRecord::Migration[8.0]
def change
add_column :search_entries, :ngram, :tsvector
add_index :search_entries, %i[account_id ngram], using: :gin, where: "record_type = 'Submitter'",
name: 'index_search_entries_on_account_id_ngram_submitter'
add_index :search_entries, %i[account_id ngram], using: :gin, where: "record_type = 'Submission'",
name: 'index_search_entries_on_account_id_ngram_submission'
add_index :search_entries, %i[account_id ngram], using: :gin, where: "record_type = 'Template'",
name: 'index_search_entries_on_account_id_ngram_template'
end
end