Oh, i see. In that case descending wont work. Well, there's always full text search that can help with this sorting problem.
On Wed, Sep 5, 2012 at 3:16 PM, Simon Metson <[email protected]> wrote: > That won't work for a compound key - Pulkit wants to sort ascending on the > first item in his key and descending on the second. Paul is talking about > new functionality that augments the descending=true option. > > > On Wednesday, 5 September 2012 at 07:29, Andrey Kuprianov wrote: > > > 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 > > <[email protected](mailto: > [email protected])>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 < > [email protected] (mailto:[email protected])> > > > 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? > > > > > > > > > > > > > > > > > > >
