A platform for community discussion. Free, open, simple.
FIX: Don't try and reindex posts that have been trashed.
Guo Xiang Tanc4997ce85f5b
diff --git a/app/jobs/scheduled/reindex_search.rb b/app/jobs/scheduled/reindex_search.rbindex 1a15ec5dd5b..5a1c784e20a 100644--- a/app/jobs/scheduled/reindex_search.rb+++ b/app/jobs/scheduled/reindex_search.rb@@ -95,9 +95,8 @@ module JobsON pd.locale = :localeAND pd.version = :versionAND pd.post_id = posts.id- LEFT JOIN topics ON topics.id = posts.topic_id+ INNER JOIN topics ON topics.id = posts.topic_idWHERE pd.post_id IS NULL- AND topics.id IS NOT NULLAND topics.deleted_at IS NULLAND posts.raw != ''ORDER BY posts.id DESCdiff --git a/spec/jobs/reindex_search_spec.rb b/spec/jobs/reindex_search_spec.rbindex df634663917..bc6b3f6efa5 100644--- a/spec/jobs/reindex_search_spec.rb+++ b/spec/jobs/reindex_search_spec.rb@@ -49,12 +49,16 @@ describe Jobs::ReindexSearch doFakeIndexer.resetend- it 'should not reinex posts that belong to a deleted topic' do+ it (+ 'should not reindex posts that belong to a deleted topic ' \+ 'or have been trashed'+ ) dopost = Fabricate(:post)post2 = Fabricate(:post)- post.post_search_data.destroy!- post2.post_search_data.destroy!+ post3 = Fabricate(:post)+ PostSearchData.delete_allpost2.topic.trash!+ post3.trash!subject.rebuild_problem_posts(indexer: FakeIndexer)