Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 45148 invoked from network); 4 Oct 2007 00:41:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Oct 2007 00:41:42 -0000 Received: (qmail 74923 invoked by uid 500); 4 Oct 2007 00:41:25 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 74738 invoked by uid 500); 4 Oct 2007 00:41:24 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 74727 invoked by uid 99); 4 Oct 2007 00:41:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 17:41:24 -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 warren@clarksnutrition.com designates 66.160.183.118 as permitted sender) Received: from [66.160.183.118] (HELO unassigned118.fc.aoindustries.com) (66.160.183.118) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2007 00:41:26 +0000 Received: from [192.168.4.47] (pool-71-110-202-177.lsanca.dsl-w.verizon.net [71.110.202.177]) (authenticated bits=0) by www7.fc.aoindustries.com (8.13.4/8.13.4) with ESMTP id l940f4cY025451 for ; Wed, 3 Oct 2007 19:41:06 -0500 Message-ID: <470436A3.4090504@clarksnutrition.com> Date: Wed, 03 Oct 2007 17:41:07 -0700 From: Warren User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: BooleanQuery questions References: <4704181A.5090502@clarksnutrition.com> <359a92830710031704v33271e30t11c58397d1d8247b@mail.gmail.com> In-Reply-To: <359a92830710031704v33271e30t11c58397d1d8247b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the reply. Everything is working correctly now. I jumped the gun without debuging it more. booleanANDSearch was not getting set correctly. Erick Erickson wrote: > I don't see a problem with your booleanANDSearch thingy, although > I haven't tried it. > > Does toString() return the same string regardless of the value of > booleanANDSearch? That would surprise me. The default > is OR, so the toString output looks like booleanANDSearch is false. > > In general, the Lucene syntax is > no symbol SHOULD > + MUST > - MUST_NOT > > If this doesn't help, could you give us the toString for your > query1 and query2? > > Erick > > On 10/3/07, Warren wrote: >> I am new to Lucene and am having problems with booleanQueries. How do you >> write Boolean OR and AND >> queries? >> >> Is this an OR query >> >> booleanQuery.add(query1, BooleanClause.Occur.SHOULD); >> booleanQuery.add(query2, BooleanClause.Occur.SHOULD); >> >> and is this an AND query >> >> booleanQuery.add(query1, BooleanClause.Occur.MUST); >> booleanQuery.add(query2, BooleanClause.Occur.MUST); >> >> Is there a problem writing it this way so I can change between the two by >> setting booleanANDSearch >> to true or false >> >> booleanQuery.add(query1,(booleanANDSearch?BooleanClause.Occur.MUST: >> BooleanClause.Occur.SHOULD)); >> booleanQuery.add(query2,(booleanANDSearch?BooleanClause.Occur.MUST: >> BooleanClause.Occur.SHOULD)); >> >> Also, when I call booleanQuery.toString(), I am getting this: >> >> (upc:creatine description:creatine content:creatine) (brand:gluten >> brand:free) (category:alc >> category:beer) >> >> It looks like each grouping is a query but how are the queries connected, >> with AND, OR or NOT? >> >> -- >> Thanks, >> >> Warren Bell >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> > -- Thanks, Warren Bell Systems Administrator Clark's Nutritional Centers 4225 Market St. Riverside, CA 92501 951-321-1960 ext. 142 909-645-8864 mobile --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org