search: support backwards ranges.
Fix things like age:1y..2y or score:5..0 returning no results.
This commit is contained in:
@@ -142,6 +142,7 @@ 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(posts.reverse, "id:#{posts[2].id}..#{posts[0].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}")
|
||||
@@ -420,6 +421,7 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
assert_tag_match([post], "age:>0s")
|
||||
assert_tag_match([post], "age:>=0s")
|
||||
assert_tag_match([post], "age:0s..1m")
|
||||
assert_tag_match([post], "age:1m..0s")
|
||||
|
||||
assert_tag_match([], "age:>1y")
|
||||
assert_tag_match([], "age:>=1y")
|
||||
|
||||
Reference in New Issue
Block a user