diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-09 15:15:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-09 15:15:43 +0300 |
commit | 15f5da601b5dd687f9fc1a1da71d791c8c3e6411 (patch) | |
tree | a7ee75c2bfbd841e3854e8ee86fc17eaedd15b65 /lib/gitlab/empty_search_results.rb | |
parent | 3d233a67cf4ab39773e3ee10a09df9eb7c3b4167 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/empty_search_results.rb')
-rw-r--r-- | lib/gitlab/empty_search_results.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/empty_search_results.rb b/lib/gitlab/empty_search_results.rb new file mode 100644 index 00000000000..71a78cb297b --- /dev/null +++ b/lib/gitlab/empty_search_results.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Gitlab + # This class has the same interface as SearchResults except + # it is empty and does not do any work. + # + # We use this when responding to abusive search requests. + class EmptySearchResults + def initialize(*) + end + + def objects(*) + Kaminari.paginate_array([]) + end + + def formatted_count(*) + '0' + end + + def highlight_map(*) + {} + end + + def aggregations(*) + [] + end + end +end |