couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenneth Tyler <...@8thfold.com>
Subject Re: MultiKey sorting in views
Date Tue, 13 Apr 2010 14:53:42 GMT
>  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.

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 = days in month - day
month index = 13 - month
for year index you have to pick a future year: 3000 say
then year index = 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

Mime
View raw message