diff options
author | Jarka Kadlecová <jarka@gitlab.com> | 2018-01-31 15:59:59 +0100 |
---|---|---|
committer | Jarka Kadlecová <jarka@gitlab.com> | 2018-02-06 16:02:02 +0100 |
commit | 7381944565701f2a8db5d58d5bc3c7e52e7f60bf (patch) | |
tree | a9bb7687b3809082555bd78dd5e1c5696d768910 /lib/gitlab/project_search_results.rb | |
parent | 0e15a5b805e832c22c67cead8c4829e6c77cd498 (diff) | |
download | gitlab-ce-7381944565701f2a8db5d58d5bc3c7e52e7f60bf.tar.gz |
Support search in API
Diffstat (limited to 'lib/gitlab/project_search_results.rb')
-rw-r--r-- | lib/gitlab/project_search_results.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 4823f703ba4..0846fdc4de3 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -2,14 +2,15 @@ module Gitlab class ProjectSearchResults < SearchResults attr_reader :project, :repository_ref - def initialize(current_user, project, query, repository_ref = nil) + def initialize(current_user, project, query, repository_ref = nil, per_page: 20) @current_user = current_user @project = project @repository_ref = repository_ref.presence || project.default_branch @query = query + @per_page = per_page end - def objects(scope, page = nil) + def objects(scope, page = nil, without_counts = true) case scope when 'notes' notes.page(page).per(per_page) @@ -20,7 +21,7 @@ module Gitlab when 'commits' Kaminari.paginate_array(commits).page(page).per(per_page) else - super(scope, page, false) + super(scope, page, without_counts) end end |