Hi Nils,

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].

Hope that helps,
--
Jason Davies

www.jasondavies.com

Reply via email to