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
Léo-Paul Géneau
gitlab-ce
Commits
edecab20
Commit
edecab20
authored
Feb 16, 2017
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'snippets-search-performance' into 'master'
Reduce query count for snippet search See merge request !9254
parents
680d37b3
2a60f4de
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 @
edecab20
...
@@ -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 @
edecab20
...
@@ -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 @
edecab20
---
title
:
Reduced query count for snippet search
merge_request
:
author
:
lib/gitlab/snippet_search_results.rb
View file @
edecab20
...
@@ -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