Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 92735 invoked from network); 3 Jul 2008 18:29:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jul 2008 18:29:56 -0000 Received: (qmail 79762 invoked by uid 500); 3 Jul 2008 18:29:57 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 79490 invoked by uid 500); 3 Jul 2008 18:29:56 -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 79473 invoked by uid 99); 3 Jul 2008 18:29:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jul 2008 11:29:56 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jul 2008 18:29:04 +0000 Received: from [10.0.2.3] (e179134136.adsl.alicedsl.de [::ffff:85.179.134.136]) (AUTH: LOGIN jan, SSL: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Thu, 03 Jul 2008 18:17:23 +0000 Message-Id: <860DFB74-40BB-4423-A9E5-EA17837539C0@apache.org> From: Jan Lehnardt To: couchdb-user@incubator.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: Views using JSON Arrays Date: Thu, 3 Jul 2008 20:17:22 +0200 References: <377590.28814.qm@web57215.mail.re3.yahoo.com> X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org On Jul 3, 2008, at 20:07, Paul Bonser wrote: > On Thu, Jul 3, 2008 at 8:01 AM, Bradford Winfrey > wrote: > >> We would get back each one of our tags as a key, yea? Only if we >> supplied one at a time. So how does one go about supplying a >> range, array (not sure what we'd call it here) of keys to be >> searched on? http://...?key=["octopus","hockey"] maybe? I'm >> unsure of the plan of attack for such a thing. Maybe I'm just >> going about it in the wrong direction. Any thoughts? > > Hey everyone. I've pretty much just been watching the mailing list > here myself. > > This is the second time somebody has asked about this since I've > started watching this mailing list. I could see it being a valuable > feature. > > Would it be valuable to add the ability to query a view with multiple > keys, getting the results for each of those keys back? Something like > http://...?key_list=["octopus","hockey"] > > If I were interested in investigating how hard it would be to add that > feature, where would I start looking in the code? This simply doesn't fit the way views work. They are single indexes that you can use for single-key or or key-range lookups. if you need random access you'd basically need to query the view as many times as you have keys to search. No matter if you do that in front or behind the API. Things to work around that: 1) In the client, compute the 'smallest' and 'largest' key and make a range lookup and simply throw away in the client what you are not interested in. You might get a lot of data with this, but maybe not, depends on your data. 2) Do single lookups. One per key. Map-index lookups are nearly instant, so running 3 or 4 is not a big deal. That might not work well for lots of keys. 3) Leverage fulltext search. The best generic solution for this is probably a fulltext index like Lucene or Sphinx could give you. 4) There might be other ways that people smarter than I am can envision :) Cheers Jan --