mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -06:00
DEV: Allow developmental post search index versions.
This commit is contained in:
parent
fe71c43c57
commit
3766122a82
@ -140,7 +140,7 @@ module Jobs
|
||||
def load_problem_post_ids(limit)
|
||||
params = {
|
||||
locale: SiteSetting.default_locale,
|
||||
version: SearchIndexer::POST_INDEX_VERSION,
|
||||
version: SearchIndexer::MIN_POST_REINDEX_VERSION,
|
||||
limit: limit
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ module Jobs
|
||||
JOIN topics ON topics.id = posts.topic_id
|
||||
LEFT JOIN post_search_data pd
|
||||
ON pd.locale = :locale
|
||||
AND pd.version = :version
|
||||
AND pd.version >= :version
|
||||
AND pd.post_id = posts.id
|
||||
WHERE pd.post_id IS NULL
|
||||
AND posts.deleted_at IS NULL
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
class SearchIndexer
|
||||
POST_INDEX_VERSION = 3
|
||||
MIN_POST_REINDEX_VERSION = 3
|
||||
TOPIC_INDEX_VERSION = 3
|
||||
CATEGORY_INDEX_VERSION = 3
|
||||
USER_INDEX_VERSION = 3
|
||||
|
@ -68,6 +68,14 @@ describe Jobs::ReindexSearch do
|
||||
expect(FakeIndexer.posts).to contain_exactly(post)
|
||||
end
|
||||
|
||||
it 'should not reindex posts with a developmental version' do
|
||||
post = Fabricate(:post, version: SearchIndexer::MIN_POST_REINDEX_VERSION + 1)
|
||||
|
||||
subject.rebuild_problem_posts(indexer: FakeIndexer)
|
||||
|
||||
expect(FakeIndexer.posts).to eq([])
|
||||
end
|
||||
|
||||
it 'should not reindex posts with empty raw' do
|
||||
post = Fabricate(:post)
|
||||
post.post_search_data.destroy!
|
||||
|
Loading…
Reference in New Issue
Block a user