couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Wolff <awo...@gmail.com>
Subject Re: MultiKey sorting in views
Date Tue, 13 Apr 2010 17:14:53 GMT
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 <N.Breunese@vpro.nl> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message