Closed theycallmeswift closed 10 years ago
Per the documentation of the underlying command, your agruments are in the wrong order; max comes before min.
ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]
In the future, please try running your commands with redis directly before reporting an issue with this client library; here is a reproduction in redis-cli
:
╭─{ yaauie @ beorn in ~ }
╰─○ redis-cli
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 Rutgers
"1"
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 Rutgers
"2"
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 CalTech
"1"
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 Rutgers
"3"
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 CalTech
"2"
redis 127.0.0.1:6379> zincrby ncaa:event:1:leaderboard 1 TCNJ
"1"
redis 127.0.0.1:6379> zrevrangebyscore ncaa:event:1:leaderboard 1 10 WITHSCORES
(empty list or set)
redis 127.0.0.1:6379> zrangebyscore ncaa:event:1:leaderboard 1 10 WITHSCORES
1) "TCNJ"
2) "1"
3) "CalTech"
4) "2"
5) "Rutgers"
6) "3"
redis 127.0.0.1:6379> zrevrangebyscore ncaa:event:1:leaderboard 10 1 WITHSCORES
1) "Rutgers"
2) "3"
3) "CalTech"
4) "2"
5) "TCNJ"
6) "1"
redis 127.0.0.1:6379>
I've encountered a strange bug where
zrevrangebyscore
returns an empty set, butzrangebyscore
with the same parameters returns a set.System Info:
Ruby Version: 2.1.1 Redis Version: 2.8.7 Library Version: 3.0.7