diff --git a/app/models/article.rb b/app/models/article.rb index dcb1eceee..1c171e06b 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -309,6 +309,7 @@ class Article < ApplicationRecord def touch_by_reaction async_score_calc index! + index_to_elasticsearch end def comments_blob diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index b7aff6ac1..375c6624c 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -851,4 +851,12 @@ RSpec.describe Article, type: :model do expect(feed_article.attributes.keys).to match_array(fields) end end + + describe "#touch_by_reaction" do + it "reindexes elasticsearch doc" do + sidekiq_assert_enqueued_with(job: Search::IndexToElasticsearchWorker, args: [described_class.to_s, article.search_id]) do + article.touch_by_reaction + end + end + end end