Return-Path: Delivered-To: apmail-lucene-general-archive@www.apache.org Received: (qmail 49502 invoked from network); 7 Jun 2009 18:32:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jun 2009 18:32:53 -0000 Received: (qmail 34918 invoked by uid 500); 7 Jun 2009 18:33:04 -0000 Delivered-To: apmail-lucene-general-archive@lucene.apache.org Received: (qmail 34839 invoked by uid 500); 7 Jun 2009 18:33:04 -0000 Mailing-List: contact general-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@lucene.apache.org Delivered-To: mailing list general@lucene.apache.org Received: (qmail 34829 invoked by uid 99); 7 Jun 2009 18:33:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Jun 2009 18:33:04 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 74.125.46.29 as permitted sender) Received: from [74.125.46.29] (HELO yw-out-2324.google.com) (74.125.46.29) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Jun 2009 18:32:53 +0000 Received: by yw-out-2324.google.com with SMTP id 2so1262738ywt.5 for ; Sun, 07 Jun 2009 11:32:32 -0700 (PDT) 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 :from:date:message-id:subject:to:content-type; bh=NCy/GdXrNS50K/IctmTH0IB1cjLHRZmXS3cXQ1iOvWs=; b=EcvdjK2S0eXvJkQ+3U4+uLy13inYthCDXnG65RafPaPIu6In2zrzT9icGeRuEteRWS 2kDPOcm0efeCYvbTozcZ7gK8dEGZGvOA5R+Pt9osK2rlfXLs9hsshUW6I5hLwP/xM2NL p2FPpYe+DJ13SP7XiQHNpFJdOc+ld6ANFD2fY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Fx8R8F27YVFLAQZqmrX+82bHNYzc9YAbFjf+XyinZ9w5PVTbUoLsmzjSRTG39wt6xP 71S8bUBapXZJ+nLV/SslqMx020z7AMGLkaFD2YMDBv3iP5XLuY4J9oKEKbm7PQO5KsDO MXlxZFOO2bGnZSJ9XYB6cQ99rRGFkpmn75ag4= MIME-Version: 1.0 Received: by 10.151.132.4 with SMTP id j4mr10848877ybn.120.1244399552221; Sun, 07 Jun 2009 11:32:32 -0700 (PDT) In-Reply-To: <23911598.post@talk.nabble.com> References: <23902784.post@talk.nabble.com> <23911598.post@talk.nabble.com> From: Ted Dunning Date: Sun, 7 Jun 2009 11:32:12 -0700 Message-ID: Subject: Re: How to structure lucene query? To: general@lucene.apache.org Content-Type: multipart/alternative; boundary=001e680f16fc44d5ee046bc65916 X-Virus-Checked: Checked by ClamAV on apache.org --001e680f16fc44d5ee046bc65916 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit In that case, you need to build a bunch of user "documents" which are the union of the fields in question. Then the retrieval is trivial. On Sun, Jun 7, 2009 at 7:28 AM, ywlee522 wrote: > > Thanks for the tip. But, no, it is not same as finding documents with both > "ABC" and "XYZ", as they can be appear in separate documents of the same > user. > > > > > Ted Dunning wrote: > > > > It is the same as finding documents with both "ABC" and "XYZ" except that > > you need to run over the results yourself and collect the user names. > > > > Lucene doesn't have a fancy query language so you can't magically do any > > group-by or count(distinct) tricks. > > > > On Sat, Jun 6, 2009 at 8:59 AM, ywlee522 wrote: > > > >> > >> > >> A document has two fields; username, date, and document text. A user can > >> have multiple documents. > >> > >> The query is: > >> > >> Of the users who have one or more documents with keyword "ABC", find > >> users > >> who also have one or more document with keyword "XYZ". > >> > >> This isn't finding documents with both "ABC" and "XYZ". How can this > be > >> done in lucene query? THANK YOU > >> > >> > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/How-to-structure-lucene-query--tp23902784p23902784.html > >> Sent from the Lucene - General mailing list archive at Nabble.com. > >> > >> > > > > > > -- > > Ted Dunning, CTO > > DeepDyve > > > > 111 West Evelyn Ave. Ste. 202 > > Sunnyvale, CA 94086 > > http://www.deepdyve.com > > 858-414-0013 (m) > > 408-773-0220 (fax) > > > > > > -- > View this message in context: > http://www.nabble.com/How-to-structure-lucene-query--tp23902784p23911598.html > Sent from the Lucene - General mailing list archive at Nabble.com. > > -- Ted Dunning, CTO DeepDyve 111 West Evelyn Ave. Ste. 202 Sunnyvale, CA 94086 http://www.deepdyve.com 858-414-0013 (m) 408-773-0220 (fax) --001e680f16fc44d5ee046bc65916--