DEV: reindex old data in a more consistent way

Previously we were grabbing arbitrary rows in many cases which makes
diagnosing issues in the indexer more complex
This commit is contained in:
Sam Saffron 2019-06-04 11:47:10 +10:00
parent 55fd3acea0
commit 77300c1d8d
1 changed files with 4 additions and 0 deletions

View File

@ -126,6 +126,7 @@ module Jobs
Category.joins(:category_search_data) Category.joins(:category_search_data)
.where('category_search_data.locale != ? .where('category_search_data.locale != ?
OR category_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION) OR category_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION)
.order('categories.id asc')
.limit(limit) .limit(limit)
.pluck(:id) .pluck(:id)
end end
@ -134,6 +135,7 @@ module Jobs
Topic.joins(:topic_search_data) Topic.joins(:topic_search_data)
.where('topic_search_data.locale != ? .where('topic_search_data.locale != ?
OR topic_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION) OR topic_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION)
.order('topics.id desc')
.limit(limit) .limit(limit)
.pluck(:id) .pluck(:id)
end end
@ -142,6 +144,7 @@ module Jobs
User.joins(:user_search_data) User.joins(:user_search_data)
.where('user_search_data.locale != ? .where('user_search_data.locale != ?
OR user_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION) OR user_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION)
.order('users.id asc')
.limit(limit) .limit(limit)
.pluck(:id) .pluck(:id)
end end
@ -150,6 +153,7 @@ module Jobs
Tag.joins(:tag_search_data) Tag.joins(:tag_search_data)
.where('tag_search_data.locale != ? .where('tag_search_data.locale != ?
OR tag_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION) OR tag_search_data.version != ?', SiteSetting.default_locale, SearchIndexer::INDEX_VERSION)
.order('tags.id asc')
.limit(limit) .limit(limit)
.pluck(:id) .pluck(:id)
end end