Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 15033 invoked from network); 23 Feb 2011 02:06:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Feb 2011 02:06:53 -0000 Received: (qmail 15154 invoked by uid 500); 23 Feb 2011 02:06:51 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 15120 invoked by uid 500); 23 Feb 2011 02:06:51 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 15112 invoked by uid 99); 23 Feb 2011 02:06:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Feb 2011 02:06:51 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jjfutbol@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Feb 2011 02:06:43 +0000 Received: by qyk10 with SMTP id 10so2784575qyk.11 for ; Tue, 22 Feb 2011 18:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to :x-mailer; bh=DMOjyJP3uNb2ItLZjF2jZM7CXj6xd5//nXYai4hquBM=; b=eQGHOUK+RcmhecYGZdF648WaRtzgvRiBXv60q6UR4MtHpSt1NGhggTvYvjfK+k5q8C ggGCfu/2mCzX7U6fau6MePwVGCtvL1jNn8gyH0z6Oy2a6/tAw0H00D20ZJo1d6b3q3Zj CGY4kyg3pVFK2wQIfWk+2Zmu22hEXkEFcbppQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=k5KtCb4mNh0ssqhg+71fV/dwj32WowN8t13wNdpljlv7vXqu5Hjt5087TNUPmWPOuK 4kyaC7sNfSKd1vtE/c8u9qhCl9zmVMAHCXh4TEgsDza5gjpWuVYXKSOcNxIaGbPApMx1 WJ6lGRWX8/jaegbz/QEuVvixpjSOHg+MJNrC0= Received: by 10.224.45.74 with SMTP id d10mr2894733qaf.304.1298426782322; Tue, 22 Feb 2011 18:06:22 -0800 (PST) Received: from [10.0.1.2] (ool-45707e40.dyn.optonline.net [69.112.126.64]) by mx.google.com with ESMTPS id nb15sm5085040qcb.2.2011.02.22.18.06.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Feb 2011 18:06:21 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) Subject: Re: Help With map function From: Javier Julio In-Reply-To: <2BB3938D-F3E1-4A8D-9A03-01C4401552AC@gmail.com> Date: Tue, 22 Feb 2011 21:06:20 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <28D2E88E-D082-47F0-91BE-D6902CAFD10A@GMAIL.COM> <2BB3938D-F3E1-4A8D-9A03-01C4401552AC@gmail.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1082) Paul, thanks for confirming. Can you elaborate on "the non-wildcard = selection criteria as a leading prefix"? What does that mean? So to handle an AND/OR statement would best be or perhaps only way to do = with multiple views? So since Andrey wanted to support "brand and = category" or "brand or category" he would need 3 views right? One for item, brand and category, second for item and brand, and the = third for item and category? On Feb 22, 2011, at 9:01 PM, Paul J. Davis wrote: > Yep, the multi-key post doesn't require string keys. >=20 > Also, when you want wild card behavior you need a view that has the = non-wildcard selection criteria as a leading prefix. It's easiest to = think about in terms of array slicing. >=20 > For the OP I would suggest multiple views with the required array = orders for the expected queries. =20 >=20 > On Feb 22, 2011, at 8:52 PM, Javier Julio wrote: >=20 >> Andrey, >>=20 >> Great question as I had been struggling with the same. In the docs = its kind of buried there but you can post multiple keys to a view. I = believe this is what you are looking for. Correct me if I'm wrong. So = I'd create a view where the index has item, brand and category and then = you can just include a key set for each grouping you want in the post = body. >>=20 >> If you look under the table with all the query params in this section = of the View docs: = http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options you'll see = a that it mentions you can post multiple keys to a view. >>=20 >> I'm still learning myself so I'm not sure if you can post complex = keys (only simple strings are used). I would assume so since its not = stated otherwise but I believe this is what will solve your problem. >>=20 >> Ciao! >> Javi >>=20 >> On Feb 22, 2011, at 8:06 PM, Andrey Cherkashin wrote: >>=20 >>> Hello, >>>=20 >>> I have a problem, I can't understand how to write map function that = solves my problem: >>>=20 >>> I have a lot of "documents", each document has type (e.g. item, = user), category and brand. So i have map functions that gives me a list = of every document that has type item (that's easy), but how i can get = list of all documents that has brand =3D=3D xxx or category =3D=3D yyy = or even brand=3D=3Dxxx&category=3Dzzz (xxx,yyy,zzz different every = time). >>=20