summaryrefslogtreecommitdiff
path: root/app/services/search_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 21:09:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 21:09:00 +0000
commit3b6bc9a3af9bf34d709cd3f6de6b495b630f159d (patch)
tree810f9603d961812ca84cad8821f63e3c9c3bca66 /app/services/search_service.rb
parent72c5d10ab9786a311515ff53e69c9638b85025de (diff)
downloadgitlab-ce-3b6bc9a3af9bf34d709cd3f6de6b495b630f159d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/search_service.rb')
-rw-r--r--app/services/search_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index 3ccd67c8d30..84d7e33c3d0 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -62,7 +62,9 @@ class SearchService
end
def search_objects(preload_method = nil)
- @search_objects ||= redact_unauthorized_results(search_results.objects(scope, page: params[:page], per_page: per_page, preload_method: preload_method))
+ @search_objects ||= redact_unauthorized_results(
+ search_results.objects(scope, page: page, per_page: per_page, preload_method: preload_method)
+ )
end
def search_highlight
@@ -71,6 +73,10 @@ class SearchService
private
+ def page
+ [1, params[:page].to_i].max
+ end
+
def per_page
per_page_param = params[:per_page].to_i