mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:01:22 +08:00
PERF: push reindex job to daily
This commit is contained in:
@ -32,7 +32,6 @@ module Jobs
|
|||||||
Post.rebake_old(250)
|
Post.rebake_old(250)
|
||||||
end
|
end
|
||||||
|
|
||||||
Search.rebuild_problem_posts
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
10
app/jobs/scheduled/reindex_search.rb
Normal file
10
app/jobs/scheduled/reindex_search.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module Jobs
|
||||||
|
# if locale changes or search algorithm changes we may want to reindex stuff
|
||||||
|
class ReindexSearch < Jobs::Scheduled
|
||||||
|
every 1.day
|
||||||
|
|
||||||
|
def execute(args)
|
||||||
|
Search.rebuild_problem_posts
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -49,6 +49,7 @@ class Search
|
|||||||
)', SiteSetting.default_locale).limit(10000)
|
)', SiteSetting.default_locale).limit(10000)
|
||||||
|
|
||||||
posts.each do |post|
|
posts.each do |post|
|
||||||
|
# force indexing
|
||||||
post.cooked += " "
|
post.cooked += " "
|
||||||
SearchObserver.index(post)
|
SearchObserver.index(post)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user