search: support backwards ranges.

Fix things like age:1y..2y or score:5..0 returning no results.
This commit is contained in:
evazion
2020-04-20 02:05:10 -05:00
parent 172095730c
commit 25159bb21c
2 changed files with 4 additions and 3 deletions

View File

@@ -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")