mant1988 / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ZRANGE sorting elements by value too (undefined behavior?) #457

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi guys! I am new to redis, and discover that ZRANGE command always sorting not 
only by score, but also by value. But ZRANGE reference on redis.io tells what 
"The elements are considered to be ordered from the lowest to the highest 
score."
No words about sorting by value. In example:

> zadd z 1 k
1
> zadd z 1 z
1
> zadd z 1 a
1
> zrange z 0 -1
1. a
2. k
3. z

Is this a undefined behavior? It is more easy to use this, but I'm afraid that 
in some cases it could work not like that.
It is possible to add words about sorting to ZRANGE on reference page?

Original issue reported on code.google.com by certa...@gmail.com on 15 Feb 2011 at 4:55

GoogleCodeExporter commented 8 years ago
Good point, added this to the docs. When scores are equal, lexicographical 
order is used.

Original comment by pcnoordh...@gmail.com on 15 Feb 2011 at 6:28