summaryrefslogtreecommitdiff
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-12-21 19:44:37 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2019-01-04 01:59:41 +0800
commit40f31486a8397c9142a0d5d0434b02d578aa8a67 (patch)
tree87e8684e20df494d5b555875166c77de8298b08b /app/helpers/search_helper.rb
parent725cd1367f8579e6c054c6cd2df42b934abfdc16 (diff)
downloadgitlab-ce-40f31486a8397c9142a0d5d0434b02d578aa8a67.tar.gz
Reduce counts in search_entries_info44353-improve-snippet-search-performance
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 80cc568820a..0ee76a51f7d 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -24,10 +24,10 @@ module SearchHelper
end
def search_entries_info(collection, scope, term)
- return unless collection.count > 0
+ return if collection.to_a.empty?
from = collection.offset_value + 1
- to = collection.offset_value + collection.count
+ to = collection.offset_value + collection.to_a.size
count = collection.total_count
"Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\""