Add search form for hidden content

Added search for comments and proposal_notifications, added tsv column
for search and rake tasks to update/create tsv vector.
This commit is contained in:
Jacek Skrzypacz
2019-03-20 11:35:41 +01:00
committed by Javi Martín
parent e66b9687a2
commit 2af7e32415
19 changed files with 254 additions and 2 deletions

View File

@@ -2,10 +2,15 @@ namespace :consul do
desc "Runs tasks needed to upgrade to the latest version"
task execute_release_tasks: ["settings:rename_setting_keys",
"settings:add_new_settings",
"execute_release_1.5.0_tasks"]
"execute_release_1.6.0_tasks"]
desc "Runs tasks needed to upgrade from 1.4.0 to 1.5.0"
task "execute_release_1.5.0_tasks": [
"active_storage:remove_paperclip_compatibility_in_existing_attachments"
]
desc "Runs tasks needed to upgrade from 1.5.0 to 1.6.0"
task "execute_release_1.6.0_tasks": [
"db:calculate_tsv"
]
end

View File

@@ -5,4 +5,15 @@ namespace :db do
I18n.enforce_available_locales = false
load(Rails.root.join("db", "dev_seeds.rb"))
end
desc "Calculates the TSV column for all comments and proposal notifications"
task calculate_tsv: :environment do
logger = ApplicationLogger.new
logger.info "Calculating tsvector for comments"
Comment.with_hidden.find_each(&:calculate_tsvector)
logger.info "Calculating tsvector for proposal notifications"
ProposalNotification.with_hidden.find_each(&:calculate_tsvector)
end
end