forked from e621ng/e621ng
Add back limit on tag count, raised defaults
In order to prevent unbounded term generation, add back tag count limit to the query generator. Updated defaults to reflect the great increase in speed.
This commit is contained in:
parent
a527a370e9
commit
eaa5ee822d
@ -135,6 +135,10 @@ class PostQueryBuilder
|
||||
q = Tag.parse_query(query_string)
|
||||
end
|
||||
|
||||
if q[:tag_count].to_i > Danbooru.config.tag_query_limit
|
||||
raise ::Post::SearchError.new("You cannot search for more than #{Danbooru.config.tag_query_limit} tags at a time")
|
||||
end
|
||||
|
||||
should = [] # These terms are ORed together
|
||||
must = [] # These terms are ANDed together
|
||||
must_not = [] # These terms are NOT ANDed together
|
||||
|
@ -556,13 +556,7 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def tag_query_limit
|
||||
if is_platinum?
|
||||
Danbooru.config.base_tag_query_limit * 2
|
||||
elsif is_gold?
|
||||
Danbooru.config.base_tag_query_limit
|
||||
else
|
||||
2
|
||||
end
|
||||
40
|
||||
end
|
||||
|
||||
def favorite_limit
|
||||
|
@ -181,14 +181,14 @@ module Danbooru
|
||||
|
||||
# Users cannot search for more than X regular tags at a time.
|
||||
def base_tag_query_limit
|
||||
6
|
||||
20
|
||||
end
|
||||
|
||||
def tag_query_limit
|
||||
if CurrentUser.user.present?
|
||||
CurrentUser.user.tag_query_limit
|
||||
else
|
||||
base_tag_query_limit * 2
|
||||
base_tag_query_limit
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user