couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hahn <m...@boutiquing.com>
Subject Re: Mapping multiple entries in an array field? (like tags)
Date Mon, 23 May 2011 01:17:44 GMT
> However, emitting tags separately gives me separate results with each tag
as key. That way client side calculation might be huge.

I'm using the method of emitting a result for each tag in the document and
I'm not seeing any huge client calculation.  I just get the list of doc ids
for each tag requested and do an intersection of the results.  Not a big
deal.  It isn't as if I have to load all the docs.


On Sun, May 22, 2011 at 3:47 AM, He Shiming <heshiming@gmail.com> wrote:

> @Patrick, thanks. However, emitting tags separately gives me separate
> results with each tag as key. That way client side calculation might
> be huge. I'll have to load each of the documents to get meaning
> results. I might also want to run reduce on this query, and the
> grouping will be done for each key. It's not really what I'm
> expecting.
>
> @Nils, thanks. I'm using lucene anyway, so I'll give it a try. I'm
> just hoping that this can be done with map/reduce, I didn't expect it
> to be difficult.
>
> On Sun, May 22, 2011 at 5:15 PM, Nils Breunese <N.Breunese@vpro.nl> wrote:
> > You could get the documents for the individual tags and perform the logic
> on the client, but when that's not feasible (and it soon stops being
> feasible) you'll want to take a look at couchdb-lucene which allows you to
> do these kinds of OR queries: https://github.com/rnewson/couchdb-lucene
> >
> > Nils.
> > ________________________________________
> > Van: He Shiming [heshiming@gmail.com]
> > Verzonden: zondag 22 mei 2011 8:59
> > Aan: user@couchdb.apache.org
> > Onderwerp: Mapping multiple entries in an array field? (like tags)
> >
> > Dear Community,
> >
> > I'm working with documents like this:
> > {
> >    "tags": ["python", "couchdb", "web"]
> > }
> >
> > I'd like to be able to query this document, by all of the following keys:
> > "python"
> > ["python", "web"]
> > ["couchdb", "python"]
> > ["web", "python", "couchdb"]
> >
> > but not by keys such as:
> > "redis"
> > ["python", "redis"]
> >
> > It's a tag-like situation. I can have the parameter and the field
> > sorted in alphabetical order if necessary. But it should support any
> > number of "tags" as the key.
> >
> > The only solution I figured, is to compose a list of possible key
> > combinations in the map function, then emit all of them. And this way,
> > one view will only be able to handle a fixed number of keys. For that
> > matter, the function gets really complicated for the 3-key (or above)
> > query. So I'm wondering if there are better ways to do this.
> >
> > Thanks!
> > He Shiming
> > ------------------------------------------------------------------------
> >  VPRO   www.vpro.nl
> > ------------------------------------------------------------------------
> >
>
>
>
> --
> Best regards,
> He Shiming
>



-- 
Mark Hahn
Website Manager
mark@boutiquing.com
949-229-1012

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