incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: A permanent view for user-entered query with complex boolean expressions?
Date Wed, 11 Feb 2009 20:01:49 GMT
On Tue, Feb 10, 2009 at 02:16:08PM -0800, Barry Wark wrote:
> >> map:
> >> function map(doc) {
> >>    for parameter in doc.parameters {
> >>        emit([parameter, doc.parameters[parameter]], doc._id)
> >>    }
> >> }
> >>
> >> reduce:
> >> function reduce(keys, values, rereduce) {
> >>    if(rereduce) {
> >>        return union(values)
> >>    }
> >>
> >>    return values
> >> }
> 
> In fact, I think I messed up; I don't really need the reduce function
> in this view do I?

And I don't believe you need to emit the doc._id as a value either; null
will do. (Couch remembers each source doc_id anyway, and provides them in
the view)

Mime
View raw message