Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
40f31486
Commit
40f31486
authored
Dec 21, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce counts in search_entries_info
parent
725cd136
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+2
-2
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+1
-1
changelogs/unreleased/44353-improve-snippet-search-performance.yml
...s/unreleased/44353-improve-snippet-search-performance.yml
+5
-0
No files found.
app/helpers/search_helper.rb
View file @
40f31486
...
...
@@ -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
}
\"
"
...
...
app/views/search/_results.html.haml
View file @
40f31486
-
if
@search_objects
.
empty?
-
if
@search_objects
.
to_a
.
empty?
=
render
partial:
"search/results/empty"
-
else
.row-content-block
...
...
changelogs/unreleased/44353-improve-snippet-search-performance.yml
0 → 100644
View file @
40f31486
---
title
:
Improve snippet search performance by removing duplicate counts
merge_request
:
23952
author
:
type
:
performance
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment