0

I have the following two sets and I'm trying to intersect them and store the result:

127.0.0.1:6379> smembers out2
1) "judy_1"

127.0.0.1:6379> zrange dateset 0 -1 withscores
 1) "judy_4"
 2) "118903"
  ....
19) "judy_1"
20) "137967"

You can see "judy_1" is present in both the set and the zset (w/the associated score of 137967). I want to intersect the "out2" and "dateset" to be left with "judy_1" and score.

I attempt to perform this and store the result in "result", but it's returning an empty set.

127.0.0.1:6379> zinterstore result 2 out2 dataset
(integer) 0
127.0.0.1:6379>
127.0.0.1:6379> smembers result
(empty list or set)
127.0.0.1:6379> zrange result 0 -1
(empty list or set)

Any help is greatly appreciated!

4

1 回答 1

1

It works at my end..

redis 127.0.0.1:6379> sadd out2 judy_1
(integer) 1
redis 127.0.0.1:6379> zadd dataseet 118903 judy_4
(integer) 1
redis 127.0.0.1:6379> zadd dataseet 137967 judy_1
(integer) 1
redis 127.0.0.1:6379> zrange dataseet 0 -1 withscores
1) "judy_4"
2) "118903"
3) "judy_1"
4) "137967"
redis 127.0.0.1:6379> zinterstore result 2 out2 dataseet
ZRANGE  result 0 -1
1) "judy_1"

which version you are using?

于 2014-02-13T03:22:58.357 回答