couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Joseph Davis <>
Subject Re: ranking a big list
Date Sun, 07 Feb 2010 01:19:00 GMT
The easiest way to accomplish this would be to emit(doc.score, 1) with  
a plain sum reduction. Then at query time just use startkey of zero  
and end key of the score you're interested in. Granted that has weird  
effects for ties on whether you bump up or down.

On Feb 6, 2010, at 7:58 PM, Matt Lyon <> wrote:

> FWIW, what you're doing here is a statistical analysis called a
> percentile rank. In what I'm doing, for any given set of sums, I want
> to know which quadrile [0-25/26-50/51-75/76-100] of all the sums any
> particular sum is in. I can't necessarily tell you how to do this in
> javascript because I'm interacting with couchdb from ruby anyway and
> using a ruby library (array_statistics) to do this kind of analysis on
> a simple sum reduce from couch, but hopefully this will point you in
> the right direction.
> On Sat, Feb 6, 2010 at 5:00 AM, Mano <> wrote:
>> Hi,
>> I have a large list of assessment scores (of about 500k students).  
>> The
>> scores can range between 0 and 200. How do I find the rank of a  
>> particular
>> score? For smaller lists, I can just sort the array of scores and  
>> for each
>> student's score I can get the index of their score in the sorted  
>> list. But
>> how do I achieve it using mapreduce?
>> Thanks,
>> mano
>> --
>> Lord, give us the wisdom to utter words that are gentle and tender,  
>> for
>> tomorrow we may have to eat them.
>>   -Sen. Morris Udall

View raw message