posts: add more free metatags.
The following metatags no longer count against the tag search limit: * is * id * date * age * filesize * filetype * parent * child * md5 * width * height * duration * mpixels * ratio * score * upvotes * downvotes * favcount * embedded * tagcount * pixiv_id * pixiv These are mostly metatags that have to do with properties of the post itself. Other metatags still count because they involve things like subqueries or joins, or they're more tag-like in function.
This commit is contained in:
@@ -7,7 +7,11 @@ class PostQuery
|
||||
class TagLimitError < Error; end
|
||||
|
||||
# Metatags that don't count against the user's tag limit.
|
||||
UNLIMITED_METATAGS = %w[status rating limit]
|
||||
UNLIMITED_METATAGS = %w[
|
||||
status rating limit is id date age filesize filetype parent child md5 width
|
||||
height duration mpixels ratio score upvote downvotes favcount embedded
|
||||
tagcount pixiv_id pixiv
|
||||
]
|
||||
|
||||
# Metatags that define the order of search results. These metatags can't be used more than once per query.
|
||||
ORDER_METATAGS = %w[order ordfav ordfavgroup ordpool]
|
||||
|
||||
@@ -1353,7 +1353,7 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
post1 = create(:post, rating: "s")
|
||||
|
||||
assert_raise(PostQuery::TagLimitError) do
|
||||
PostQuery.search("a b c rating:s width:10 height:10 user:bob", tag_limit: 5)
|
||||
PostQuery.search("a b c user:bob fav:bob pool:disgustingly_adorable", tag_limit: 5)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1363,6 +1363,7 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
assert_tag_match([post1], "aaa bbb rating:s")
|
||||
assert_tag_match([post1], "aaa bbb status:active")
|
||||
assert_tag_match([post1], "aaa bbb limit:20")
|
||||
assert_tag_match([post1], "aaa bbb filesize:<100mb width:<10000 height:<10000 limit:20")
|
||||
end
|
||||
|
||||
should "succeed for exclusive tag searches with no other tag" do
|
||||
|
||||
Reference in New Issue
Block a user