Commit 8f142a7a authored by Yorick Peterse's avatar Yorick Peterse Committed by Felipe Artur

Merge branch 'snippets-search-performance' into 'master'

Reduce query count for snippet search

See merge request !9254
parent 8b786ede
......@@ -7,7 +7,7 @@
= snippet.title
by
= 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
%span.light= time_ago_with_tooltip(snippet.created_at)
%h4.snippet-title
......
......@@ -18,6 +18,6 @@
%span
by
= 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
%span.light= time_ago_with_tooltip(snippet_title.created_at)
---
title: Reduced query count for snippet search
merge_request:
author:
......@@ -31,11 +31,11 @@ module Gitlab
private
def snippet_titles
limit_snippets.search(query).order('updated_at DESC')
limit_snippets.search(query).order('updated_at DESC').includes(:author)
end
def snippet_blobs
limit_snippets.search_code(query).order('updated_at DESC')
limit_snippets.search_code(query).order('updated_at DESC').includes(:author)
end
def default_scope
......
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