search: support repeated numeric-valued metatags.
Support using the same numeric-valued metatag twice in the same search. Numeric-valued metatags are those taking an integer, float, filesize, or date argument. Previously using the same metatag twice would cause the second metatag to overwrite the first metatag. Examples: * "id:>5 id:<10" * "width:>500 width:<1000" * "date:>2019-01-01 date:<2020-01-01"
This commit is contained in:
@@ -142,6 +142,9 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
assert_tag_match([posts[1], posts[0]], "id:<=#{posts[1].id}")
|
||||
assert_tag_match([posts[2], posts[0]], "id:#{posts[0].id},#{posts[2].id}")
|
||||
assert_tag_match(posts.reverse, "id:#{posts[0].id}..#{posts[2].id}")
|
||||
|
||||
assert_tag_match([], "id:#{posts[0].id} id:#{posts[2].id}")
|
||||
assert_tag_match([posts[1]], "id:>#{posts[0].id} id:<#{posts[2].id}")
|
||||
end
|
||||
|
||||
should "return posts for the fav:<name> metatag" do
|
||||
@@ -412,6 +415,16 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
assert_tag_match([post], "age:<1w")
|
||||
assert_tag_match([post], "age:<1mo")
|
||||
assert_tag_match([post], "age:<1y")
|
||||
|
||||
assert_tag_match([post], "age:<=1y")
|
||||
assert_tag_match([post], "age:>0s")
|
||||
assert_tag_match([post], "age:>=0s")
|
||||
assert_tag_match([post], "age:0s..1m")
|
||||
|
||||
assert_tag_match([], "age:>1y")
|
||||
assert_tag_match([], "age:>=1y")
|
||||
assert_tag_match([], "age:1y..2y")
|
||||
assert_tag_match([], "age:>1y age:<1y")
|
||||
end
|
||||
|
||||
should "return posts for the ratio:<x:y> metatag" do
|
||||
@@ -490,6 +503,8 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
post2 = create(:post)
|
||||
|
||||
assert_tag_match([post1], "md5:abcd")
|
||||
assert_tag_match([post1], "md5:ABCD")
|
||||
assert_tag_match([post1], "md5:123,abcd")
|
||||
end
|
||||
|
||||
should "return posts for a source:<text> search" do
|
||||
|
||||
Reference in New Issue
Block a user