mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Simplify hashtag query service, perf increase for 'any' tags (#9298)
This commit is contained in:
parent
1d38c9750a
commit
6a65d87f4d
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
class HashtagQueryService < BaseService
|
class HashtagQueryService < BaseService
|
||||||
def call(tag, params, account = nil, local = false)
|
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])
|
all = tags_for(params[:all])
|
||||||
none = tags_for(params[:none])
|
none = tags_for(params[:none])
|
||||||
|
|
||||||
@query = Status.as_tag_timeline(tag, account, local)
|
Status.distinct
|
||||||
.tagged_with_all(all)
|
.as_tag_timeline(tags, account, local)
|
||||||
.tagged_with_none(none)
|
.tagged_with_all(all)
|
||||||
@query = @query.distinct.or(self.class.new.call(any, params.except(:any), account, local).distinct) if any
|
.tagged_with_none(none)
|
||||||
@query
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
Loading…
Reference in New Issue
Block a user