Brian,

good points

On Thu, Oct 22, 2009 at 6:54 AM, Brian Candler <b.cand...@pobox.com> wrote:

> On Wed, Oct 21, 2009 at 08:21:50AM -0500, Nathan Stott wrote:
> > You have two options.  1) use couchdb-lucene
> > 2) emit multiple rows for each document.  something like this:
> > function(doc) {
> >     var iterDate = doc.startDate;
> >     var endDate = doc.endDate;
> >     while (iterDate < endDate) {
> >         emit(iterDate);
> >         iterDate.setDay(iterDate.getDay() + 1) // make this as
> fine-grained
> > as you like
> >     }
> > }
>
> Option (3): have views for startDate and endDate. Query the first view for
> all docs with startDate < today, query the second view for all docs with
> today < endDate, then intersect on the client.
>
> Option (4): emit([startDate, endDate]), query for startDate < today, then
> use a _list function to filter out matches with an endDate out of range.
>
> These two options can get expensive with very large numbers of documents.
> Option (2) above may be better, but can also get expensive with very wide
> ranges between startDate and endDate.
>
> A compromise is to take option (2) with large-grained buckets to get a set
> of possible candidates, and then post-filter in the client or in _list.
>

Reply via email to