Nils,

On 8 Jul 2009, at 18:14, Jason Davies wrote:

On 8 Jul 2009, at 15:11, Nils Breunese wrote:

Chris Anderson wrote:

The pattern used on http://jchrisa.net/cal/_design/cal/index.html is
to emit once an hour for every hour the event is active, this way you
can always query for current events (use 15 minutes or 1 minute
granularity if that fits your model better)

How do you 'emit once an hour'? Do you use a cronjob or something?

I think he just means do something like:

function (doc) {
 for (var d = doc.start_date; d < doc.end_date; d[3]++) {
   // do some stuff to push carries of hour up to day, month, year ...
   emit(d, ...);
 }
}

Here I'm assuming that doc.start_date and doc.end_date are in the form: [year, month, day, hour].

If you want to have a look at Chris's calendar app code, you should install 'couchapp' and do:

    couchapp clone http://jchrisa.net/cal/_design/cal

Oh the beauty of it! :-)

Cheers,
--
Jason Davies

www.jasondavies.com

Reply via email to