summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-12-11 09:43:34 +0100
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2019-02-27 20:19:50 +0100
commit022ee0c0c91d30dea3c1c0472525e86ec8379827 (patch)
treee50e74ec12ffcfe3e3964f53cbdce872af7f4527 /app/finders
parentcd063eec32a8b32d9b118f6cbdb0e96de0d0ec51 (diff)
downloadgitlab-ce-022ee0c0c91d30dea3c1c0472525e86ec8379827.tar.gz
don't filter tags by taggable type
Due to performance reasons we cannot use the type filter on the tags. The table for ActsAsTaggableOn is too big and too unoptimized, such that the queries time out on production. See the discussion https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19740#note_120087938 for more info.
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
index 81e22c85d34..71dffb72dce 100644
--- a/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
+++ b/app/finders/autocomplete/acts_as_taggable_on/tags_finder.rb
@@ -5,30 +5,19 @@ module Autocomplete
class TagsFinder
LIMIT = 20
- def initialize(taggable_type:, params:)
- @taggable_type = taggable_type
+ def initialize(params:)
@params = params
end
def execute
@tags = ::ActsAsTaggableOn::Tag.all
- filter_by_taggable_type!
search!
limit!
@tags
end
- def filter_by_taggable_type!
- # rubocop: disable CodeReuse/ActiveRecord
- @tags = @tags
- .joins(:taggings)
- .where(taggings: { taggable_type: @taggable_type.name })
- .distinct
- # rubocop: enable CodeReuse/ActiveRecord
- end
-
def search!
search = @params[:search]