Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 46320 invoked from network); 27 Jul 2006 15:53:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jul 2006 15:53:36 -0000 Received: (qmail 72599 invoked by uid 500); 27 Jul 2006 15:53:29 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 72568 invoked by uid 500); 27 Jul 2006 15:53:29 -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 72557 invoked by uid 99); 27 Jul 2006 15:53:29 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 08:53:29 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of paulo.silveira@gmail.com designates 72.14.214.200 as permitted sender) Received: from [72.14.214.200] (HELO hu-out-0102.google.com) (72.14.214.200) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 08:53:27 -0700 Received: by hu-out-0102.google.com with SMTP id 28so203849hug for ; Thu, 27 Jul 2006 08:53:06 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=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; b=qL1enTAXGGSxbJ2h4dJdlugA9M3zkf6ajVL7wY7Jsyn8MWos9EF/Wx1mwEwHS84p6/nBBq8nhmuZL/Z1Y9s4T59h5PeOofI0lEZ/euNT8oKfXFusvPYO98FdoMlPLTEL6ha3ESuJQVEW3BBr3LbFIBny2LZOe/qXOcm1BPE7Xis= Received: by 10.35.123.10 with SMTP id a10mr13356946pyn; Thu, 27 Jul 2006 08:53:06 -0700 (PDT) Received: by 10.35.64.7 with HTTP; Thu, 27 Jul 2006 08:53:04 -0700 (PDT) Message-ID: <6026e8b0607270853n1ebf6d0ev17f4e3b03ebb6442@mail.gmail.com> Date: Thu, 27 Jul 2006 12:53:05 -0300 From: "Paulo Silveira" Sender: paulo.silveira@gmail.com To: java-user@lucene.apache.org Subject: Re: MultiFieldQueryParser.parse deprecated. What can I use? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <44C70783.6060305@nuix.com.au> X-Google-Sender-Auth: 5998dea472cec3e2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ok, I just tested it. So consider: =09=09String string =3D "word -foo"; =09=09String[] fields =3D { "title", "body" }; For the MultField I have: MultiFieldQueryParser qp =3D new MultiFieldQueryParser(fields, SearchEngine.ANALYZER); Query fieldsQuery =3D qp.parse(string); System.out.println(fieldsQuery); > (title:word body:word) -(title:foo body:foo) And for the boolean: BooleanQuery fieldsQuery =3D new BooleanQuery(); for (String field : fields) { =09QueryParser qp =3D new QueryParser(field, SearchEngine.ANALYZER); =09fieldsQuery.add(qp.parse(string), BooleanClause.Occur.SHOULD); } System.out.println(fieldsQuery); > (title:word -title:foo) (body:word -body:foo) quite different!! On 7/26/06, Doron Cohen wrote: > By the resulted query toString(), boolean query would not work correctly: > > qtxt: a foo > [1] Multi Field Query (OR) : (title:a body:a) (title:foo body:foo) > [2] Multi Field Query (AND): +(title:a body:a) +(title:foo body:foo) > [3] Boolean Query : (title:a title:foo) (body:a body:foo) > --> By a chance, all are equivalent, returning doc1. > > qtxt: a -foo > [1] Multi Field Query (OR) : (title:a body:a) -(title:foo body:foo) > [2] Multi Field Query (AND): +(title:a body:a) -(title:foo body:foo) > [3] Boolean Query : (title:a -title:foo) (body:a -body:foo) > --> Here [1,2] "correctly" return no docs, but [3] returns doc1. > > qtxt: +a +foo > [1] Multi Field Query (OR) : +(title:a body:a) +(title:foo body:foo) > [2] Multi Field Query (AND): +(title:a body:a) +(title:foo body:foo) > [3] Boolean Query : (+title:a +title:foo) (+body:a +body:foo) > --> Now [1,2] "correctly" return doc1, but [3] returns no docs. > > qtxt: a +foo > [1] Multi Field Query (OR) : (title:a body:a) +(title:foo body:foo) > [2] Multi Field Query (AND): +(title:a body:a) +(title:foo body:foo) > [3] Boolean Query : (title:a +title:foo) (body:a +body:foo) > --> All "correctly" return doc1. > > - Doron > > Daniel Noll wrote on 25/07/2006 23:11:15: > > > Marvin Humphrey wrote: > > > I believe that this will cause difficulties with prohibited terms. S= ay > > > > you have these two documents... > > > > > > Doc 1: > > > title: a > > > body: foo > > > Doc 2: > > > title: b > > > body: bar > > > > It's not just prohibited terms. Happens for required terms too. A > > search for "a AND foo" would return no hits there even though it's a hi= t. > > > > Daniel > > > > > > -- > > Daniel Noll > > > > Nuix Pty Ltd > > Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 069= 9 > > Web: http://www.nuix.com.au/ Fax: +61 2 9212 690= 2 > > > > This message is intended only for the named recipient. If you are not > > the intended recipient you are notified that disclosing, copying, > > distributing or taking any action in reliance on the contents of this > > message or attachment is strictly prohibited. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > > For additional commands, e-mail: java-user-help@lucene.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --=20 Paulo E. A. Silveira Caelum Ensino e Solu=E7=F5es em Java http://www.caelum.com.br/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org