couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <heshim...@gmail.com>
Subject Re: Mapping multiple entries in an array field? (like tags)
Date Sun, 22 May 2011 09:03:31 GMT
Hi Alex, thanks for the quick response. But with only a start/endkey
pair, how am I supposed to match a tag that is not at the front of an
array?

Consider these two documents:
doc1: ["akhet", "couchdb", "python", "redis", "riak"]
doc2: ["couchdb", "redis"]

They are sorted, and they can be emitted. However, specifying
startkey=["couchdb"]&endkey=["couchdb", {}] will only match doc2 (or
did I understand it wrong?). And it doesn't look like there's an easy
way to match both docs with keys like ["couchdb", "redis"].

What do you mean by another key sequence? What will it look like?

On Sun, May 22, 2011 at 4:28 PM, Alexander Shorin <kxepal@gmail.com> wrote:
> Hi!
>
> I think that better would be to return sorted list of lowercase tags
> as key and access to them via startkey and endkey params.
> ?startkey=["couchdb"]&endkey=["couchdb", null]
> So you could access to all of them, but only while you're keeping
> their order in key. For other combinations (you'd like to start with
> python tag, not couchdb) you have to generate another key sequence.
>
> This would be more optimal solution instead of generation of all
> available combinations of tags: for 4 tags you would have 24 emitted
> records, for 5 - 120, for 6 - 720 and more, and this is without case
> problem.
>
> ------------------
> ,,,^..^,,,
>
>



-- 
Best regards,
He Shiming

Mime
View raw message