couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <>
Subject Re: Mapping multiple entries in an array field? (like tags)
Date Sun, 22 May 2011 10:47:13 GMT
@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

@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 <> 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:
> Nils.
> ________________________________________
> Van: He Shiming []
> Verzonden: zondag 22 mei 2011 8:59
> Aan:
> 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
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------

Best regards,
He Shiming

View raw message