Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7A8DDF6B for ; Wed, 5 Sep 2012 06:30:16 +0000 (UTC) Received: (qmail 37307 invoked by uid 500); 5 Sep 2012 06:30:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 37129 invoked by uid 500); 5 Sep 2012 06:30:13 -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 37074 invoked by uid 99); 5 Sep 2012 06:30:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 06:30:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andrey.kouprianov@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-lpp01m010-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 06:30:03 +0000 Received: by lage4 with SMTP id e4so85071lag.11 for ; Tue, 04 Sep 2012 23:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=3m7QkOUe4/3F+g8lMfGZGY/DbS3T3/JaGc1l57Igd7c=; b=TEZ2cyyaHIWnZR2ZArDDRSSEREKeTs0PsFq7DhqdkTL3zJamXz50scl/SrkbUz6kqi wcxZYHqPWNXADjzHznZqj+FAebJfOQn07xWY731fTb6LSSgsGa0iKJpQR2WrE8N+znzy 2rCXigJvkjwN+oD79xjckTZK7FOyrAujMdOFY1wd0HSiB99wc8hfvHMfWItpZ68lsaAD Sg4gVywN5YCzG/nnJiswwW8yS1pLayh0plXLULi7xC8WvgceXuSUbZtXWOngYyBlduLI Y8k5tOe6siHyjFzEEDk92ERATONsl40MrCAK6zx8oW1BQIwpv39FLs0085aDXnwI/X5o Ek9Q== Received: by 10.112.24.101 with SMTP id t5mr7406287lbf.123.1346826582730; Tue, 04 Sep 2012 23:29:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.10.8 with HTTP; Tue, 4 Sep 2012 23:29:22 -0700 (PDT) In-Reply-To: References: From: Andrey Kuprianov Date: Wed, 5 Sep 2012 14:29:22 +0800 Message-ID: Subject: Re: How to specify different sort order for the elements of a compound map key? To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=90e6ba10a70f09a85604c8ee8073 --90e6ba10a70f09a85604c8ee8073 Content-Type: text/plain; charset=ISO-8859-1 It's not per view, but per single query. Take a look here for more details: http://wiki.apache.org/couchdb/HTTP_view_API#View_Generation_Options On Wed, Sep 5, 2012 at 1:42 PM, Paul Davis wrote: > Unfortunately no. There was a patch to define a sort order for array > keys but it was never committed to master. Its not a terribly > difficult patch but there hasn't ever been much of a call for such a > thing (AFAIK you're the second ever) and it has some awkward edge > cases. Perhaps a revisit would be kosher. > > For background the original patch was a design doc member of [true, > false, true, true] (["asc", "desc", "asc", "asc"] would be > equivalently easy). We'll need to look into making this a per-view > option as well as including it in the design doc signature. We'd also > need to account for the newer raw collation option as well and define > that. Or perhaps make this a new collation option. > > If anyone wants to dig into this I can point to the major code areas > and general points of concern but I don't have time to dig in > immediately. > > On Tue, Sep 4, 2012 at 11:16 PM, Pulkit Singhal > wrote: > > I have a map with a compound key which naturally sorts in an ascending > > order as: > > [No, 2011] > > [No, 2012] > > [Yes, 2011] > > [Yes, 2012] > > > > But I want it to sort as: > > [No, 2012] > > [No, 2011] > > [Yes, 2012] > > [Yes, 2011] > > > > Which means the first element in the key No/Yes should be sorted in an > > ascending order, whereas the timestamp should be sorted in a descending > > order. > > > > Is there a way to do this in a query? Or do I have to come up with some > > hack in my mapping function? > --90e6ba10a70f09a85604c8ee8073--