summaryrefslogtreecommitdiff
path: root/app/services/search/global_service.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-01 17:56:14 +0100
committerRobert Speicher <rspeicher@gmail.com>2016-03-11 15:25:22 -0500
commit013542965c2b6d84d28aab4823e5400897610087 (patch)
tree2d56dad1d6c7acd2e515bb4e472e454098b9f2c9 /app/services/search/global_service.rb
parent2cf7f3f410832560bf049b24fbcaa27c1e3f30c7 (diff)
downloadgitlab-ce-013542965c2b6d84d28aab4823e5400897610087.tar.gz
Refactor Gitlab::SearchResults
Instead of plucking IDs this class now uses ActiveRecord::Relation objects. Plucking IDs is problematic as searching for projects can lead to a huge amount of IDs being loaded into memory only to be used as an argument for another query (instead of just using a sub-query).
Diffstat (limited to 'app/services/search/global_service.rb')
-rw-r--r--app/services/search/global_service.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb
index e904cb6c6fc..e1e94c5cc38 100644
--- a/app/services/search/global_service.rb
+++ b/app/services/search/global_service.rb
@@ -10,9 +10,8 @@ module Search
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
projects = ProjectsFinder.new.execute(current_user)
projects = projects.in_namespace(group.id) if group
- project_ids = projects.pluck(:id)
- Gitlab::SearchResults.new(project_ids, params[:search])
+ Gitlab::SearchResults.new(projects, params[:search])
end
end
end