From couchdb-user-return-1383-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Fri Sep 26 16:42:12 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 17147 invoked from network); 26 Sep 2008 16:42:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Sep 2008 16:42:12 -0000 Received: (qmail 41662 invoked by uid 500); 26 Sep 2008 16:42:03 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 41636 invoked by uid 500); 26 Sep 2008 16:42:03 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 41618 invoked by uid 99); 26 Sep 2008 16:42:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 09:42:03 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jchris@gmail.com designates 209.85.217.19 as permitted sender) Received: from [209.85.217.19] (HELO mail-gx0-f19.google.com) (209.85.217.19) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 16:41:00 +0000 Received: by gxk12 with SMTP id 12so8773933gxk.12 for ; Fri, 26 Sep 2008 09:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=gJGtTubv1YhOK++yPaakGQrOOVIqRL1v+tR84GWq78g=; b=UVk7PHV+6Db10O3f7Vvpf0ohkIpazp4eB6eBlJIx9LrzIzWJahQ+uqxsZEZ2D00523 xoj5MIxzzDk5Rcba14yOK81b/gEScWPRuShH+sNFeZqxLpRfwGWtgjbsSiA9hOdUcB0U bcCflvN1XxncCoH9RZUZoxBnR1nhAzTdZ8HlA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=R2Qsq8beYAB1+Da419iDw2oTq61iPewJFdrXJSSr0fC/nlDxGx2bxA2GnesOYli4aj sSijWHMcoIsFSiC7D8yl6n4FPnsvWQiWF2FLCvK611hMy30JLt9UQEjHw9jQGFgyTCxs MY64Kn7nN5/+htCQbOgOfOaAbkc7xsHUR3ApY= Received: by 10.142.50.5 with SMTP id x5mr684735wfx.68.1222447233541; Fri, 26 Sep 2008 09:40:33 -0700 (PDT) Received: by 10.142.49.15 with HTTP; Fri, 26 Sep 2008 09:40:33 -0700 (PDT) Message-ID: Date: Fri, 26 Sep 2008 09:40:33 -0700 From: "Chris Anderson" Sender: jchris@gmail.com To: couchdb-user@incubator.apache.org Subject: Re: Multiple filters on a large data set In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1E0C812D-E968-4AEB-BA64-1DBDB2C1B099@apache.org> X-Google-Sender-Auth: 10bdcc91fd2ab50e X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Sep 26, 2008 at 4:54 AM, Jaap van der Plas wrote: > Greetings Jan, > > the goal is not so much to allow full-text search on the documents > fields, as to be able to retrieve records based any set of field names > with specific values (or perhaps ranges.) Basically, what the 'where' > clause can do in SQL. You could do a view like: function(doc) { var f; for (f in doc) { emit([f, doc[f]], null); } } This would emit a key based on the name and value of every field in a document. You might do well to optimize it by avoiding the fields that start with "_" or other fields you don't care to index. You'll use a lot of disc this way, but assuming you know at query time which field you are interested in, it should be very fast to lookup keys and key ranges within a given field. -- Chris Anderson http://jchris.mfdz.com