What are the top movies in this Redis sorted set? -


i've downloaded movies imdb (movies-list) here: http://www.imdb.com/interfaces

i want count how given movie appears in list of redis sorted sets, bit confused of outcome:

 redis 127.0.0.1:6379> zrangebyscore 'movies:title' 5000 +inf withscores  1) "countdown"  2) "5254"  3) "the bold , beautiful"  4) "5322"  5) "days of our lives"  6) "5451"  7) "neighbours"  8) "6442"  9) "the new price right" 10) "7633" 11) "coronation street" 12) "8097" 

i have movie appears @ top. also, bit confused score. 5k, 6k, 7k mean?

the script use experiment rake task this:

   task :import     file = file.new(env['file'])     redis = redis.new     file.each_line |l|       if l =~ /^"(.*)"/         puts $1         redis.zincrby 'movies:title', 1, $1       end     end 

you might want try using zrevrangebyscore instead of zrangebyscore.

syntax:

zrevrangebyscore key max min [withscores] [limit offset count] 

for example, in case:

zrangebyscore 'movies:title' +inf 5000 withscores 

reference


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -