From 06276bd3550e589c520027c16f108b92a48fb44a Mon Sep 17 00:00:00 2001
From: Phil Hughes <me@iamphill.com>
Date: Thu, 21 Apr 2016 11:05:50 +0100
Subject: [PATCH] Correctly shows no results text Correct search results count

---
 app/helpers/search_helper.rb        | 2 +-
 app/views/search/_results.html.haml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 43169d1c9db..7f585cd5dd9 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -23,7 +23,7 @@ module SearchHelper
     if collection.count > 0
       from = collection.offset_value + 1
       to = collection.offset_value + collection.length
-      count = collection.count
+      count = collection.total_count
 
       "Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\""
     end
diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml
index 252c1508a50..204f5a36f85 100644
--- a/app/views/search/_results.html.haml
+++ b/app/views/search/_results.html.haml
@@ -1,4 +1,4 @@
-- if @search_results.empty?
+- if @objects.empty?
   = render partial: "search/results/empty"
 - else
   .gray-content-block
-- 
GitLab