Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 87857 invoked from network); 13 Apr 2010 17:15:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Apr 2010 17:15:21 -0000 Received: (qmail 27382 invoked by uid 500); 13 Apr 2010 17:15:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 27352 invoked by uid 500); 13 Apr 2010 17:15:19 -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 27344 invoked by uid 99); 13 Apr 2010 17:15:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 17:15:19 +0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=AWL,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of awolff@gmail.com designates 209.85.221.175 as permitted sender) Received: from [209.85.221.175] (HELO mail-qy0-f175.google.com) (209.85.221.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 17:15:15 +0000 Received: by qyk5 with SMTP id 5so8070131qyk.3 for ; Tue, 13 Apr 2010 10:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=xVApyyu7vrBwC4WOKngRv+OeerkMGxgOwaXZUTr8ibU=; b=GGa7mkDgESCsIj3tSE5B9OUFz0GaI9PPoK0WsmfdZkHnJyqKzgBaGdBsI54pkrlbFM C2EceyQ9veL/p9z8oBuWwGwWdY8F3nYP8rMvViNpFlR3GjZAOpLFfk2T6gP+tF0i+O/A s1kHY7ArTSWo863OgwgLsTfFVh07Rg/k4liOw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=k5YgXtA8q39IB71EcaVWLghXRU+JdXZe1Zf0D9tF50K+N5oQ9BqTyOoEYMcEnqj+h/ MCQVsdgCkkeTkCcXexy84rWOFywwgRgjK7+m3AeFXEghR714lW7/1HE3UFYXPMA9fmvD 2ATVk/BR4tggixJJaJq/8YAivbgsx772kb7Pw= MIME-Version: 1.0 Received: by 10.229.231.1 with HTTP; Tue, 13 Apr 2010 10:14:53 -0700 (PDT) In-Reply-To: <4BC489AF.4030504@vpro.nl> References: <4BC489AF.4030504@vpro.nl> Date: Tue, 13 Apr 2010 10:14:53 -0700 Received: by 10.229.218.21 with SMTP id ho21mr2646661qcb.79.1271178894141; Tue, 13 Apr 2010 10:14:54 -0700 (PDT) Message-ID: Subject: Re: MultiKey sorting in views From: Adam Wolff To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016362842fa6e6c670484216640 --0016362842fa6e6c670484216640 Content-Type: text/plain; charset=ISO-8859-1 I understood the issue to be that if you query for multiple authors, the results are sorted by author, then by date. You'd need to merge the results for each author to get a chronological list of documents by date. I don't think there's a simple fix for this, right? A On Tue, Apr 13, 2010 at 8:11 AM, Nils Breunese wrote: > Pavan Kumar wrote: > > I have documents with author and submitted time ( utc value of date ) >> fields . Now i need to sort descending ( i.e latest first ) on time and >> filter by author in a view. >> >> I tried a few things like given below but they don't work. My "view" >> knowledge needs lot of catching up.. Any pointers would help.. >> >> 1) Filters by author but doesn't sort by time >> >> startkey: [ author , 0 ] >> endkey : [ author, now ] >> descending : true >> >> Map: >> emit([doc.author,doc.submit_at],doc ) >> > > What is the format of your submit_at field? If you use a format that > alfabetically sorts like it would do if you sorted chronologically, then > this would work, right? I use something like that myself using > timestamps in RFC 3339 format ("Date and Time on the Internet: > Timestamps") [0] which look like this: > > 2010-04-13T17:00:00+01:00 > > (year-month-dayThours:minutes:seconds and optional offset) > > The view keys will automatically be sorted alfabetically, but for RFC > 3339 timestamps this will also be chronologically. I guess things like > UNIX timestamps stored as a JSON number would also work, but they don't > score as high on the human readability scale. > > Nils Breunese. > > [0] http://www.ietf.org/rfc/rfc3339.txt > > De informatie vervat in deze e-mail en meegezonden bijlagen is uitsluitend > bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie > bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking > van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO > staat niet in voor de juiste en volledige overbrenging van de inhoud van een > verzonden e-mail, noch voor tijdige ontvangst daarvan. > --0016362842fa6e6c670484216640--