mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -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)
|
def load_problem_post_ids(limit)
|
||||||
params = {
|
params = {
|
||||||
locale: SiteSetting.default_locale,
|
locale: SiteSetting.default_locale,
|
||||||
version: SearchIndexer::POST_INDEX_VERSION,
|
version: SearchIndexer::MIN_POST_REINDEX_VERSION,
|
||||||
limit: limit
|
limit: limit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ module Jobs
|
|||||||
JOIN topics ON topics.id = posts.topic_id
|
JOIN topics ON topics.id = posts.topic_id
|
||||||
LEFT JOIN post_search_data pd
|
LEFT JOIN post_search_data pd
|
||||||
ON pd.locale = :locale
|
ON pd.locale = :locale
|
||||||
AND pd.version = :version
|
AND pd.version >= :version
|
||||||
AND pd.post_id = posts.id
|
AND pd.post_id = posts.id
|
||||||
WHERE pd.post_id IS NULL
|
WHERE pd.post_id IS NULL
|
||||||
AND posts.deleted_at IS NULL
|
AND posts.deleted_at IS NULL
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class SearchIndexer
|
class SearchIndexer
|
||||||
POST_INDEX_VERSION = 3
|
POST_INDEX_VERSION = 3
|
||||||
|
MIN_POST_REINDEX_VERSION = 3
|
||||||
TOPIC_INDEX_VERSION = 3
|
TOPIC_INDEX_VERSION = 3
|
||||||
CATEGORY_INDEX_VERSION = 3
|
CATEGORY_INDEX_VERSION = 3
|
||||||
USER_INDEX_VERSION = 3
|
USER_INDEX_VERSION = 3
|
||||||
|
@ -68,6 +68,14 @@ describe Jobs::ReindexSearch do
|
|||||||
expect(FakeIndexer.posts).to contain_exactly(post)
|
expect(FakeIndexer.posts).to contain_exactly(post)
|
||||||
end
|
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
|
it 'should not reindex posts with empty raw' do
|
||||||
post = Fabricate(:post)
|
post = Fabricate(:post)
|
||||||
post.post_search_data.destroy!
|
post.post_search_data.destroy!
|
||||||
|
Loading…
Reference in New Issue
Block a user