You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Brian Candler <B....@pobox.com> on 2009/02/11 21:01:49 UTC
Re: A permanent view for user-entered query with complex boolean
expressions?
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)