mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Reindex post for search when post is moved to a different topic.
* This is causing certain posts to appear in searches incorrectly as `PostSearchData#raw_data` contains the outdated title, category name and tag names.
This commit is contained in:
@@ -134,7 +134,13 @@ class SearchIndexer
|
||||
category_name = topic.category&.name if topic
|
||||
tag_names = topic.tags.pluck(:name).join(' ') if topic
|
||||
|
||||
if Post === obj && (obj.saved_change_to_cooked? || force)
|
||||
if Post === obj &&
|
||||
(
|
||||
obj.saved_change_to_cooked? ||
|
||||
obj.saved_change_to_topic_id? ||
|
||||
force
|
||||
)
|
||||
|
||||
if topic
|
||||
SearchIndexer.update_posts_index(obj.id, topic.title, category_name, tag_names, obj.cooked)
|
||||
SearchIndexer.update_topics_index(topic.id, topic.title, obj.cooked) if obj.is_first_post?
|
||||
|
||||
Reference in New Issue
Block a user