Reduce counts in search_entries_info

This commit is contained in:
Heinrich Lee Yu 2018-12-21 19:44:37 +08:00
parent 725cd1367f
commit 40f31486a8
3 changed files with 8 additions and 3 deletions

View file

@ -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}\""

View file

@ -1,4 +1,4 @@
- if @search_objects.empty?
- if @search_objects.to_a.empty?
= render partial: "search/results/empty"
- else
.row-content-block

View file

@ -0,0 +1,5 @@
---
title: Improve snippet search performance by removing duplicate counts
merge_request: 23952
author:
type: performance