mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Don't join on tags unnecessarily when matching all tags
This commit is contained in:
@@ -459,7 +459,6 @@ class TopicQuery
|
||||
result = result.preload(:tags)
|
||||
|
||||
if @options[:tags] && @options[:tags].size > 0
|
||||
result = result.joins(:tags)
|
||||
|
||||
if @options[:match_all_tags]
|
||||
# ALL of the given tags:
|
||||
@@ -476,6 +475,7 @@ class TopicQuery
|
||||
end
|
||||
else
|
||||
# ANY of the given tags:
|
||||
result = result.joins(:tags)
|
||||
if @options[:tags][0].is_a?(Integer)
|
||||
result = result.where("tags.id in (?)", @options[:tags])
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user