Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 15325 invoked from network); 12 Feb 2009 11:22:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2009 11:22:45 -0000 Received: (qmail 11799 invoked by uid 500); 12 Feb 2009 11:22:41 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 11684 invoked by uid 500); 12 Feb 2009 11:22: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 11641 invoked by uid 99); 12 Feb 2009 11:22:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 03:22:40 -0800 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of clairon@gmail.com designates 209.85.220.20 as permitted sender) Received: from [209.85.220.20] (HELO mail-fx0-f20.google.com) (209.85.220.20) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 11:22:29 +0000 Received: by fxm13 with SMTP id 13so1872341fxm.11 for ; Thu, 12 Feb 2009 03:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hbxyo2+k8mDyZjIJrdYe9JHfzehA2DdkqqqscrAdDFc=; b=Ydql4nSdtgzXLzZykiT2219xllEOYJXAA5k+YHQo4i8ezOZTnc3CncpC7Zp1FSaJRU FwWFXeFDNfeAeU4uoS3csX9+MQjKmYqjQ4rnffp6Ta0/CQT8j0Ilw93l5+WGMrp1bYNs Qp2LEetDE6vjHTIdfxKOXKaqKyM1ag8lHBx8Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=eVjbDMBo9NMske5vssxP82/E3HphiND/WE24DSon6QW/j0LRCXH8GALMYeZuQdu58u yEMyU3F+IzgUfJkacPoFIpjaOUY0Ih9+gMJCOzk4/5PKOolwE8GsjVfa5hulS5UxtytJ 0YYQ2qm1Uf1JDf3IAK5L/M3BIVuV4It2gA5jc= MIME-Version: 1.0 Received: by 10.103.168.5 with SMTP id v5mr301466muo.77.1234437726720; Thu, 12 Feb 2009 03:22:06 -0800 (PST) In-Reply-To: References: <4b307fd10902120242v3bbbc93fs92c88503eb632fe9@mail.gmail.com> Date: Thu, 12 Feb 2009 12:22:06 +0100 Message-ID: <4b307fd10902120322o7d6e8a59u4abba87049509da9@mail.gmail.com> Subject: Re: playing with tags From: Nicolas Clairon To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Thanks for your quick response. the line: curl -X POST http://localhost:5984/blog/_view/articles/by_tags -d '{"keys":["python", "couchdb"]}' gives me all the articles tagged with "python" *or* "couchdb"... but how can I handle this to have only the articles tagged with "python" *and* "couchdb" in one shot ? On Thu, Feb 12, 2009 at 11:53 AM, Jan Lehnardt wrote: > Hi, > > See http://wiki.apache.org/couchdb/HTTP_view_API > > and "POST" under "Query Options". > > You can POST a JSON structure with all your keys to > a view and get all matching rows. > > Cheers > Jan > -- > > On 12 Feb 2009, at 11:42, Nicolas Clairon wrote: > >> Hi there ! >> >> I'm playing with tags these time and a question comes to me. >> For exemple, I have a bunch of blog articles: >> >> article1 = { >> ...snip..., >> tags : ["couchdb", "python", "best practices"], >> } >> >> article2 = { >> ...snip..., >> tags : ["python", "best practices"], >> } >> >> article3 = { >> ...snip..., >> tags : ["couchdb", "best practices"], >> } >> >> and a view wich emit tags: >> >> function(doc){ >> if (doc.type=="article"){ >> for (var i in doc.tags){ >> emit( doc.tags[i], doc ) >> } >> } >> } >> >> We can get all articles wich are tagged with "couchdb" easily: >> >> http://localhost:5984/blog/_view/article/by_tag?key="couchdb" >> >> but now, I want all articles wich are tagged with "couchdb" *and* "python" >> (I want the article1). Is there a method to do it directly with CouchDB >> views ? >> Something like that : >> >> http://localhost:5984/blog/_view/article/by_tag?key_in=["couchdb", >> "python"] >> >> For the moment, I have to do it by program, firing 2 views and merge >> the results... >> >> We can also think something like this: >> >> http://localhost:5984/blog/_view/article/by_tag?onekey_in=["couchdb", >> "python"] >> >> wich will get all articles which are tagged with "couchdb" *or* >> "python"... >> >> Does it already exists in CouchDB ? >> > >