about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorJames Kiesel <james.kiesel@gmail.com>2018-11-20 00:49:50 +1300
committerEugen Rochko <eugen@zeonfederated.com>2018-11-19 12:49:50 +0100
commit6a65d87f4dff317b37632fbe0a42027f606fd55c (patch)
tree9483e21a6ed42bb05bb2453fb23cf624121e0e08 /app/services
parent1d38c9750a478703d3ce087d4c42cfc2118f830d (diff)
Simplify hashtag query service, perf increase for 'any' tags (#9298)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/hashtag_query_service.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/services/hashtag_query_service.rb b/app/services/hashtag_query_service.rb
index 86558a446..5773d78c6 100644
--- a/app/services/hashtag_query_service.rb
+++ b/app/services/hashtag_query_service.rb
@@ -2,15 +2,14 @@
 
 class HashtagQueryService < BaseService
   def call(tag, params, account = nil, local = false)
-    any  = tags_for(params[:any])
+    tags = tags_for(Array(tag.name) | Array(params[:any])).pluck(:id)
     all  = tags_for(params[:all])
     none = tags_for(params[:none])
 
-    @query = Status.as_tag_timeline(tag, account, local)
-                   .tagged_with_all(all)
-                   .tagged_with_none(none)
-    @query = @query.distinct.or(self.class.new.call(any, params.except(:any), account, local).distinct) if any
-    @query
+    Status.distinct
+          .as_tag_timeline(tags, account, local)
+          .tagged_with_all(all)
+          .tagged_with_none(none)
   end
 
   private