From c1cd9e064739eeb74af3ac5282339242facae2e2 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 10 Aug 2016 17:25:34 -0400 Subject: [PATCH] PERF: For estimates, we don't need to worry about deleted --- lib/search.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/search.rb b/lib/search.rb index c09e03ba1..2333fe7d2 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -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)