couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cy Scott <csc...@gmail.com>
Subject Re: Views and AND/OR-like Functionality
Date Fri, 05 Mar 2010 02:53:28 GMT
Great, thanks for the help. Looks like couchdb-lucene is the way to go.

On Thu, Mar 4, 2010 at 5:16 PM, Dmitry Unkovsky <oil.crayons@gmail.com>wrote:

> If your query isn't manageable with 1 complex-key view (like
> ['category','subcategory','type']) then couchdb-lucene [1] is the
> simplest way to go. See here [2] what you can expect of it.
>
> [1] http://github.com/rnewson/couchdb-lucene
> [2] http://lucene.apache.org/java/2_0_0/queryparsersyntax.html
>
> On Fri, Mar 5, 2010 at 2:28 AM, Cy Scott <cscott@gmail.com> wrote:
> > Just getting started with CouchDB (loving it btw) and am wrapping my
> brain
> > around the views. I've seen mention that CouchDB doesn't really handle
> > ANDing or ORing a la SQL, but is there some way to emulate it?
> >
> > Here's an example scenario. Say I have documents for different sweaters
> in
> > the form of (with _id, _rev, etc.):
> >
> > {
> >  "color": "Red", "size": 4, "price": 8.00
> >
> > }
> >
> >
> > My data has sweaters of different colors, sizes and prices. The
> > problem I'm having is when I want to get data for different
> > permutations like: ALL blue and red sweaters that are size 5 or ANY
> > green sweaters under $30. I've tried complex keys [doc.color,
> > doc.size, doc.price] but don't know if this is the right direction.
> >
> >
> > My simple map function looks like function(doc) { if(doc)
> > emit([doc.color, doc.size, doc.price], null); };
> >
> >
> > | key               | value
> > |----------------------------
> > |["Blue",  5, 15]  | null
> > |["Green", 4, 25]  | null
> > |["Red", 5, 10] | null
> >
> >
> > Anyone have any thoughts on how to best implement this type of
> > scenario? Or links to some info, previous thread that might have
> > covered this. Appreciate any and all help!
> >
>
>
>
> --
> DU
>

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