diff options
author | Charles Bushong <bushong1@gmail.com> | 2014-08-29 15:22:45 -0400 |
---|---|---|
committer | Charles Bushong <bushong1@gmail.com> | 2014-08-29 15:32:07 -0400 |
commit | 4cca1b050a0e80e4ce6bb67f530549a2f28af630 (patch) | |
tree | 31d5c5897f7b5e041a921ba221042d1a9bb6a0e1 /app/services/search | |
parent | 8a7d10af2329342ca003300847ace4793c66f854 (diff) | |
download | gitlab-ce-4cca1b050a0e80e4ce6bb67f530549a2f28af630.tar.gz |
Adding in snippet search functionality
http://feedback.gitlab.com/forums/176466-general/suggestions/5529795-search-though-snippets
Diffstat (limited to 'app/services/search')
-rw-r--r-- | app/services/search/snippet_service.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/search/snippet_service.rb b/app/services/search/snippet_service.rb new file mode 100644 index 00000000000..8ca0877321d --- /dev/null +++ b/app/services/search/snippet_service.rb @@ -0,0 +1,14 @@ +module Search + class SnippetService + attr_accessor :current_user, :params + + def initialize(user, params) + @current_user, @params = user, params.dup + end + + def execute + snippet_ids = Snippet.accessible_to(current_user).pluck(:id) + Gitlab::SnippetSearchResults.new(snippet_ids, params[:search]) + end + end +end |