Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 68327 invoked from network); 7 Dec 2010 09:21:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Dec 2010 09:21:42 -0000 Received: (qmail 37876 invoked by uid 500); 7 Dec 2010 09:21:40 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 37720 invoked by uid 500); 7 Dec 2010 09:21:40 -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 37712 invoked by uid 99); 7 Dec 2010 09:21:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Dec 2010 09:21:39 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [178.209.166.152] (HELO caterpillar.leasingborsen.dk) (178.209.166.152) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Dec 2010 09:21:33 +0000 Received: by caterpillar.leasingborsen.dk (Postfix, from userid 1002) id D3A57292B1; Tue, 7 Dec 2010 10:24:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on caterpillar.leasingborsen.dk X-Spam-Level: Received: from [10.14.75.23] (unknown [178.209.168.27]) by caterpillar.leasingborsen.dk (Postfix) with ESMTPA id 87FE929247 for ; Tue, 7 Dec 2010 10:24:07 +0100 (CET) Message-ID: <4CFDFC86.6040607@zedeler.dk> Date: Tue, 07 Dec 2010 10:21:10 +0100 From: Michael Zedeler User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12pre) Gecko/20101026 Shredder/3.1.6pre MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: Suggestions for View Keys References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Old-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,AWL autolearn=ham version=3.2.5 On 2010-12-07 03:55, Anand Chitipothu wrote: > 2010/12/7 King Huang: >> I have a view whose view keys are currently of the following form: >> >> [k, x, y, z] >> [k, x, y, 0] >> [k, x, 0, z] >> [k, x, 0, 0] >> [k, 0, y, z] >> [k, 0, y, 0] >> [k, 0, 0, z] >> [k, 0, 0, 0] >> >> There are multiple values for k, x, y, and z, and x, y, z can be undefined (represented by 0 here). >> >> What I want to be able to fetch are, given k, x, y, and z, all the view rows with (key and (x or 0) and (y or 0) and (z or 0)). I'm having difficultly coming up with an appropriate view key structure where the view rows will be sorted in a manner that allows me to select that. Does anyone have any suggestions? > You can do that in two ways. > > 1. Query for all possible combinations. [k, x, y, z], [k, x, y, 0], > [k, x, 0, z], [k, x, 0, 0], [k, 0, y, z], [k, 0, y, 0], [k, 0, 0, z], > [k, 0, 0, 0]. > > 2. Query for k and write a list function that filters the required values. I am doing this: 3. write a view for each of the columns (k, x, y, z), query each view and aggregate the results using set operations. Regards, Michael.