diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-09 17:50:43 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-09 17:50:43 +0400 |
commit | 0e78d00bcb8fd0214fb6c592c7b2814f7a70cd42 (patch) | |
tree | 0ea5b75d650fc92b82c9da193c5ce8d9e2d98ddd /lib/gitlab | |
parent | 04cf074552a047c1b50c54d38a1fd18c7b64c784 (diff) | |
parent | 9edf6d4dd08d3bd74df22645a919dbf26d22faf7 (diff) |
Merge pull request #7695 from coverer/search_wiki
Added search wiki feature
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/project_search_results.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 90511662b20..409177cb8bd 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -14,13 +14,16 @@ module Gitlab notes.page(page).per(per_page) when 'blobs' Kaminari.paginate_array(blobs).page(page).per(per_page) + when 'wiki_blobs' + Kaminari.paginate_array(wiki_blobs).page(page).per(per_page) else super end end def total_count - @total_count ||= issues_count + merge_requests_count + blobs_count + notes_count + @total_count ||= issues_count + merge_requests_count + blobs_count + + notes_count + wiki_blobs_count end def blobs_count @@ -31,6 +34,10 @@ module Gitlab @notes_count ||= notes.count end + def wiki_blobs_count + @wiki_blobs_count ||= wiki_blobs.count + end + private def blobs @@ -41,6 +48,15 @@ module Gitlab end end + def wiki_blobs + if !project.wiki_enabled? + [] + else + Repository.new(ProjectWiki.new(project).path_with_namespace). + search_files(query) + end + end + def notes Note.where(project_id: limit_project_ids).search(query).order('updated_at DESC') end |