mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
PERF: For estimates, we don't need to worry about deleted
This commit is contained in:
parent
fc311dbe3b
commit
c1cd9e0647
|
@ -131,10 +131,10 @@ class Search
|
|||
def self.min_post_id_no_cache
|
||||
return 0 unless SiteSetting.search_prefer_recent_posts?
|
||||
|
||||
offset = Post.count - SiteSetting.search_recent_posts_size
|
||||
offset = Post.with_deleted.count - SiteSetting.search_recent_posts_size
|
||||
return 0 if offset <= 0
|
||||
|
||||
Post.order(:id).offset(offset).limit(1).pluck(:id)[0]
|
||||
Post.with_deleted.order(:id).offset(offset).limit(1).pluck(:id)[0]
|
||||
end
|
||||
|
||||
def self.min_post_id(opts=nil)
|
||||
|
|
Loading…
Reference in New Issue
Block a user