Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 43575 invoked from network); 23 Sep 2010 08:05:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Sep 2010 08:05:19 -0000 Received: (qmail 20592 invoked by uid 500); 23 Sep 2010 08:05:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 20223 invoked by uid 500); 23 Sep 2010 08:05:16 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 20215 invoked by uid 99); 23 Sep 2010 08:05:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 08:05:15 +0000 X-ASF-Spam-Status: No, hits=2.9 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.82.54] (HELO mail-ww0-f54.google.com) (74.125.82.54) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 08:05:09 +0000 Received: by wwb22 with SMTP id 22so1550573wwb.23 for ; Thu, 23 Sep 2010 01:04:48 -0700 (PDT) Received: by 10.216.21.204 with SMTP id r54mr1106893wer.95.1285229088128; Thu, 23 Sep 2010 01:04:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.179.145 with HTTP; Thu, 23 Sep 2010 01:04:27 -0700 (PDT) In-Reply-To: References: From: Aaron Miller Date: Thu, 23 Sep 2010 01:04:27 -0700 Message-ID: Subject: Re: Filtering of view results To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016364d1c8740bdb10490e8b728 --0016364d1c8740bdb10490e8b728 Content-Type: text/plain; charset=ISO-8859-1 If date is what you want to sort by and you don't mind not being able to intersect filters you can use your complex keys like this (emitting multiple rows per doc), and you'll only need the one view: emit(["branch",doc.branch,doc.date); emit(["platform",doc.platform,doc.date); Then you can query /whateverview?startkey=["branch","4.0"]&endkey=["branch","4.0",{}] The combined filtering is not currently possible. If you -really- need it you can http://en.wikipedia.org/wiki/Merge_join on the client side as long as you can collate whatever you're sorting by on both "queries". In this example, the doc.date field. The gist of it is that when intersecting two datasets sorted by the same field you always know that there are no matches in a set that appear before key the of the last element you looked at in the other set, so you can rule out large chunks of data at a time for searching through. On Mon, Sep 13, 2010 at 12:12 AM, Henrik Skupin wrote: > Hi, > > Using complex keys for my views gives me a problem with filtering the > results. Lets say I have two filters: > > Branch: "All", "4.0", "3.6" > Platform: "All", "Windows NT", "Linux", "Mac" > > Per default no filtering is active and all results get shown sorted by > date. > The key which is used for emit looks like: > > emit([doc.date, doc.branch, doc.platform], { ... }]); > > But how can I re-use the view to only show results for branch:4.0 sorted by > date or even combined branch:4.0 & platform=Mac? I tried with > ?key=[{},"4.0",{}] but none results get returned. Does the key option not > allow to specify catchall values? Sadly I can't find any information about > the usage of key. > > I hope that is somehow possible. > > Thanks, > > -- > Henrik Skupin > QA Engineer > Mozilla Corporation > --0016364d1c8740bdb10490e8b728--