incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Stott <nrst...@gmail.com>
Subject Re: Finding with two fields
Date Thu, 22 Oct 2009 14:52:46 GMT
Brian,

good points

On Thu, Oct 22, 2009 at 6:54 AM, Brian Candler <B.Candler@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.
>

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