Commit 40f31486 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Reduce counts in search_entries_info

parent 725cd136
...@@ -24,10 +24,10 @@ module SearchHelper ...@@ -24,10 +24,10 @@ module SearchHelper
end end
def search_entries_info(collection, scope, term) def search_entries_info(collection, scope, term)
return unless collection.count > 0 return if collection.to_a.empty?
from = collection.offset_value + 1 from = collection.offset_value + 1
to = collection.offset_value + collection.count to = collection.offset_value + collection.to_a.size
count = collection.total_count count = collection.total_count
"Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\"" "Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\""
......
- if @search_objects.empty? - if @search_objects.to_a.empty?
= render partial: "search/results/empty" = render partial: "search/results/empty"
- else - else
.row-content-block .row-content-block
......
---
title: Improve snippet search performance by removing duplicate counts
merge_request: 23952
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment