Quantcast
Channel: How do I find the index of the first occurrence of a score in a sorted Redis set? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How do I find the index of the first occurrence of a score in a sorted Redis set?

$
0
0

I'm writing a search engine using Dewey Decimal call numbers to categorize information. The scheme is as follows:

123.45

2 is a sub-category of 1. 3 is a sub-category of 2. 4 a sub-category of 3. Etc.

It's the same numbering system libraries use to sort their books. 200 for example is religion. 210 is Philosophy & Theory of Religion. 211 is Concepts of God.

The site is one continuous catalog that goes from one subject to the next. Each link is given a score in Redis (the link's Dewey Decimal call no.). The site is setup for 50 links per page. I've got a function which calculates the zrange to pull from the server depending on the page the user's accessing.

Is there a way that I can specify a score and find the index of the first occurrence matching said score -- that way I don't have to iterate the entire database looking for scores when users enter a call no?


Viewing all articles
Browse latest Browse all 2