Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 58808 invoked from network); 13 Apr 2010 14:54:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Apr 2010 14:54:19 -0000 Received: (qmail 89361 invoked by uid 500); 13 Apr 2010 14:54:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 89294 invoked by uid 500); 13 Apr 2010 14:54:18 -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 89239 invoked by uid 99); 13 Apr 2010 14:54:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Apr 2010 14:54:18 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) 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 14:54:10 +0000 Received: by qyk5 with SMTP id 5so7867327qyk.3 for ; Tue, 13 Apr 2010 07:53:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.222.133 with HTTP; Tue, 13 Apr 2010 07:53:42 -0700 (PDT) In-Reply-To: References: Date: Tue, 13 Apr 2010 07:53:42 -0700 Received: by 10.229.232.137 with SMTP id ju9mr7537160qcb.54.1271170422232; Tue, 13 Apr 2010 07:53:42 -0700 (PDT) Message-ID: Subject: Re: MultiKey sorting in views From: Kenneth Tyler To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org > =A0I 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. can you make a composite key: author + ':' + day + month + year where you use a reverse index for the day, month... so for jan 1 you use 3112 for jan 10 you use 2112 day index =3D days in month - day month index =3D 13 - month for year index you have to pick a future year: 3000 say then year index =3D 3000 - year then jan 1, 2010 becomes 31121990 jan 1, 2009 becomes 31121991 if i posted both posting then the composite key would be tylerken:31121990 tylerken:31121991 and that should sort in author date descending order ken tyler