Its gonna depend on the exact keys you're going to be paging through.
But for the base case where you only want to page over exact keys, you
would add in a reduce view with a function like:

function(keys,values,rereduce)
{
    return values.length ;
}

And then when you query the reduce for the row count for a given key,
make sure you use the group=true parameter.

If instead you're doing sub key matches, you'll have to run through
and calculate the row count for each type of query (read as: You have
to make a new reduce view).

Also remember that if your map functions are byte identical, then only
one btree is generated (which is good). Chris Anderson has an
extremely useful script couchview in his couchrest github repo for
managing views on disk and pushing them into a database. You should be
able to find them at [1].

Paul

[1] http://github.com/jchris/couchrest



On Mon, Aug 25, 2008 at 12:10 PM, Patrick Aljord <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 25, 2008 at 10:58 AM, Paul Davis
> <[EMAIL PROTECTED]> wrote:
>>So while it may look like a pain to get the
>> counts for a specific subset of a view, it really is one of the better
>> solutions.
>
> ok thanks, could you give me any hint on how to write this reduce in a
> generic way for pagination? I'm writing a mapper for couchdb, is there
> a way to this in a general way so that it can be used for any view or
> is it too specific to each query/view?
>
> Thanks in advance,
>
> Pat
>

Reply via email to