Re-index existing articles with DataUpdateScript (#6109) [deploy]

This commit is contained in:
Ridhwana 2020-02-17 17:14:50 +02:00 committed by GitHub
parent 2ae8d71241
commit 6356089ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,7 @@
module DataUpdateScripts
class ReIndexExistingArticlesWithApproved
def run
Article.published.find_each { |article| Article.trigger_index(article, false) }
end
end
end

View file

@ -0,0 +1,8 @@
require "rails_helper"
require Rails.root.join("lib/data_update_scripts/20200217131245_re_index_existing_articles_with_approved.rb")
describe DataUpdateScripts::ReIndexExistingArticlesWithApproved do
it "triggers a re-index on articles" do
expect(Article).to respond_to(:trigger_index)
end
end