summaryrefslogtreecommitdiff
path: root/app/services/search
diff options
context:
space:
mode:
authorCharles Bushong <bushong1@gmail.com>2014-08-29 15:22:45 -0400
committerCharles Bushong <bushong1@gmail.com>2014-08-29 15:32:07 -0400
commit4cca1b050a0e80e4ce6bb67f530549a2f28af630 (patch)
tree31d5c5897f7b5e041a921ba221042d1a9bb6a0e1 /app/services/search
parent8a7d10af2329342ca003300847ace4793c66f854 (diff)
downloadgitlab-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.rb14
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