diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-01 20:01:09 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-11 23:25:22 +0300 |
commit | 42fde69d39234368f8252febc9bf6ca3eca6f275 (patch) | |
tree | a0e1a9cf6808195653d4f8e383862a7500c6e5e5 /lib | |
parent | 013542965c2b6d84d28aab4823e5400897610087 (diff) |
Refactor Gitlab::SnippetSearchResults
This removes the need for plucking snippet IDs into memory.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/snippet_search_results.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/snippet_search_results.rb b/lib/gitlab/snippet_search_results.rb index addda95be2b..e0e74ff8359 100644 --- a/lib/gitlab/snippet_search_results.rb +++ b/lib/gitlab/snippet_search_results.rb @@ -2,10 +2,10 @@ module Gitlab class SnippetSearchResults < SearchResults include SnippetsHelper - attr_reader :limit_snippet_ids + attr_reader :limit_snippets - def initialize(limit_snippet_ids, query) - @limit_snippet_ids = limit_snippet_ids + def initialize(limit_snippets, query) + @limit_snippets = limit_snippets @query = query end @@ -35,11 +35,11 @@ module Gitlab private def snippet_titles - Snippet.where(id: limit_snippet_ids).search(query).order('updated_at DESC') + limit_snippets.search(query).order('updated_at DESC') end def snippet_blobs - Snippet.where(id: limit_snippet_ids).search_code(query).order('updated_at DESC') + limit_snippets.search_code(query).order('updated_at DESC') end def default_scope |