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
8f142a7a
Commit
8f142a7a
authored
Feb 16, 2017
by
Yorick Peterse
Committed by
Felipe Artur
Feb 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'snippets-search-performance' into 'master'
Reduce query count for snippet search See merge request !9254
parent
8b786ede
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
app/views/search/results/_snippet_blob.html.haml
app/views/search/results/_snippet_blob.html.haml
+1
-1
app/views/search/results/_snippet_title.html.haml
app/views/search/results/_snippet_title.html.haml
+1
-1
changelogs/unreleased/snippets-search-performance.yml
changelogs/unreleased/snippets-search-performance.yml
+4
-0
lib/gitlab/snippet_search_results.rb
lib/gitlab/snippet_search_results.rb
+2
-2
No files found.
app/views/search/results/_snippet_blob.html.haml
View file @
8f142a7a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
snippet
.
title
=
snippet
.
title
by
by
=
link_to
user_snippets_path
(
snippet
.
author
)
do
=
link_to
user_snippets_path
(
snippet
.
author
)
do
=
image_tag
avatar_icon
(
snippet
.
author
_email
),
class:
"avatar avatar-inline s16"
,
alt:
''
=
image_tag
avatar_icon
(
snippet
.
author
),
class:
"avatar avatar-inline s16"
,
alt:
''
=
snippet
.
author_name
=
snippet
.
author_name
%span
.light
=
time_ago_with_tooltip
(
snippet
.
created_at
)
%span
.light
=
time_ago_with_tooltip
(
snippet
.
created_at
)
%h4
.snippet-title
%h4
.snippet-title
...
...
app/views/search/results/_snippet_title.html.haml
View file @
8f142a7a
...
@@ -18,6 +18,6 @@
...
@@ -18,6 +18,6 @@
%span
%span
by
by
=
link_to
user_snippets_path
(
snippet_title
.
author
)
do
=
link_to
user_snippets_path
(
snippet_title
.
author
)
do
=
image_tag
avatar_icon
(
snippet_title
.
author
_email
),
class:
"avatar avatar-inline s16"
,
alt:
''
=
image_tag
avatar_icon
(
snippet_title
.
author
),
class:
"avatar avatar-inline s16"
,
alt:
''
=
snippet_title
.
author_name
=
snippet_title
.
author_name
%span
.light
=
time_ago_with_tooltip
(
snippet_title
.
created_at
)
%span
.light
=
time_ago_with_tooltip
(
snippet_title
.
created_at
)
changelogs/unreleased/snippets-search-performance.yml
0 → 100644
View file @
8f142a7a
---
title
:
Reduced query count for snippet search
merge_request
:
author
:
lib/gitlab/snippet_search_results.rb
View file @
8f142a7a
...
@@ -31,11 +31,11 @@ module Gitlab
...
@@ -31,11 +31,11 @@ module Gitlab
private
private
def
snippet_titles
def
snippet_titles
limit_snippets
.
search
(
query
).
order
(
'updated_at DESC'
)
limit_snippets
.
search
(
query
).
order
(
'updated_at DESC'
)
.
includes
(
:author
)
end
end
def
snippet_blobs
def
snippet_blobs
limit_snippets
.
search_code
(
query
).
order
(
'updated_at DESC'
)
limit_snippets
.
search_code
(
query
).
order
(
'updated_at DESC'
)
.
includes
(
:author
)
end
end
def
default_scope
def
default_scope
...
...
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