zrevrangebyscore with scores

58 views
Skip to first unread message

E. Ulrich Kriegel

unread,
Nov 28, 2015, 9:21:02 AM11/28/15
to vert.x
Hi there,
I'm trying to port a java application witch uses reds to vertex.

How do i get zrevrange sorted by scores with scores in Vert.x? I found only zrevrangebyscore.

Thanks in advance.

-- Ulrich

Paulo Lopes

unread,
Nov 28, 2015, 12:09:37 PM11/28/15
to vert.x
what is the redis command you're trying to run?
Message has been deleted

E. Ulrich Kriegel

unread,
Nov 28, 2015, 12:33:11 PM11/28/15
to vert.x
Hi Paolo,
i need the following original reds command "ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]"
but zrevrangebyscore returns a list of members only.

Paulo Lopes

unread,
Nov 28, 2015, 2:18:27 PM11/28/15
to vert.x
but this is what redis returns a list, see here:

redis.io/commands/ZREVRANGEBYSCORE

E. Ulrich Kriegel

unread,
Nov 29, 2015, 3:59:03 AM11/29/15
to vert.x
If you execute ZREVRANGEBYSCORE key 1 0 WITHSCORES 
you will get the scores to. The pedis library for Java returns a list of Tuples containing the member and the score.

Paulo Lopes

unread,
Nov 29, 2015, 4:25:22 AM11/29/15
to vert.x
The redis client as the name states is a client, it allows you to connect to redis and maps method names to commands, that's it, it is not a mapper. See it like a jdbc driver, it is not hibernate if you understand what i am trying to say.

If you want to run the zrevrangebyscore and you run the command on REDIS you will get a list and that is exactly what the redis client does nothing else.

If you expect extended behavior then you might need to implement it yourself. The important thing here is that redis is fast and has high performance because it is simple so that was the main concern implementing the client too.

for example what the redis server do and the client also does is:


> ZREVRANGEBYSCORE key 1 0 WITHSCORES

< key1
< score1
< key2
< score2
...
< keyN
< scoreN

Now maybe we can make a improvement to transform this to an hash like we already do for hgetall but that will be an improvement it is not a bug...

E. Ulrich Kriegel

unread,
Nov 29, 2015, 5:29:28 AM11/29/15
to vert.x


On Sunday, November 29, 2015 at 10:25:22 AM UTC+1, Paulo Lopes wrote:
The redis client as the name states is a client, it allows you to connect to redis and maps method names to commands, that's it, it is not a mapper. See it like a jdbc driver, it is not hibernate if you understand what i am trying to say.

If you want to run the zrevrangebyscore and you run the command on REDIS you will get a list and that is exactly what the redis client does nothing else.

If you expect extended behavior then you might need to implement it yourself. The important thing here is that redis is fast and has high performance because it is simple so that was the main concern implementing the client too.

  

for example what the redis server do and the client also does is:

> ZREVRANGEBYSCORE key 1 0 WITHSCORES

< key1
< score1
< key2
< score2
...
< keyN
< scoreN

Now maybe we can make a improvement to transform this to an hash like we already do for hgetall but that will be an improvement it is not a bug...
I do not expect an extended behavior. If i get a list with an even number of entries containing score and member it would be fine.
My problem is that i don't know how to configure, that i get both, score and members. Until now, i only managed to get the members 

Paulo Lopes

unread,
Nov 29, 2015, 3:17:42 PM11/29/15
to vert.x
redis.zrevrangebyscore(key, "+inf", "-inf", new RangeLimitOptions().useWithScores(), reply3 -> {});

E.Ulrich Kriegel

unread,
Nov 29, 2015, 3:56:58 PM11/29/15
to ve...@googlegroups.com
Thanks

Mit freundlichem Gruß
---ukriegel
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/Uqa9ZBmKn_o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/85e8e7be-83e7-4979-87c8-5a7ffb3a67d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages