From d5c1e66b1e69cb240a4b207fecc926c21e4f93c5 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 22 Oct 2023 18:34:05 +0200 Subject: [PATCH] remove pg_search --- Gemfile | 1 - Gemfile.lock | 4 ---- app/controllers/search_controller.rb | 2 +- app/models/answer.rb | 3 --- app/models/question.rb | 3 --- ...20231022155815_create_pg_search_documents.rb | 17 ----------------- 6 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 db/migrate/20231022155815_create_pg_search_documents.rb diff --git a/Gemfile b/Gemfile index b6e3712be..552a6fd5d 100644 --- a/Gemfile +++ b/Gemfile @@ -119,4 +119,3 @@ gem "mail", "~> 2.7.1" gem "prometheus-client", "~> 4.2" -gem "pg_search", "~> 2.3" diff --git a/Gemfile.lock b/Gemfile.lock index 6fdf5200c..c9dfd28f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,9 +289,6 @@ GEM ast (~> 2.4.1) racc pg (1.5.4) - pg_search (2.3.6) - activerecord (>= 5.2) - activesupport (>= 5.2) pghero (3.3.4) activerecord (>= 6) prometheus-client (4.2.1) @@ -545,7 +542,6 @@ DEPENDENCIES oj openssl (~> 3.2) pg - pg_search (~> 2.3) pghero prometheus-client (~> 4.2) puma diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index bdb9a9ca5..38cb84c65 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -4,6 +4,6 @@ def index query = params[:q] return if query.blank? - @results = PgSearch.multisearch(query).limit(10) + @results = [] end end diff --git a/app/models/answer.rb b/app/models/answer.rb index 9f76153ac..71417252e 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -1,9 +1,6 @@ class Answer < ApplicationRecord extend Answer::TimelineMethods - include PgSearch::Model - multisearchable against: [:content] - belongs_to :user, counter_cache: :answered_count belongs_to :question, counter_cache: :answer_count has_many :comments, dependent: :destroy diff --git a/app/models/question.rb b/app/models/question.rb index 0ecf14be9..0a6adec04 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -1,9 +1,6 @@ class Question < ApplicationRecord include Question::AnswerMethods - include PgSearch::Model - multisearchable against: [:content] - belongs_to :user, optional: true has_many :answers, dependent: :destroy has_many :inboxes, dependent: :destroy diff --git a/db/migrate/20231022155815_create_pg_search_documents.rb b/db/migrate/20231022155815_create_pg_search_documents.rb deleted file mode 100644 index 628721916..000000000 --- a/db/migrate/20231022155815_create_pg_search_documents.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreatePgSearchDocuments < ActiveRecord::Migration[6.1] - def up - say_with_time("Creating table for pg_search multisearch") do - create_table :pg_search_documents do |t| - t.text :content - t.belongs_to :searchable, polymorphic: true, index: true - t.timestamps null: false - end - end - end - - def down - say_with_time("Dropping table for pg_search multisearch") do - drop_table :pg_search_documents - end - end -end