Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 35425 invoked from network); 17 Sep 2006 11:36:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Sep 2006 11:36:54 -0000 Received: (qmail 6337 invoked by uid 500); 17 Sep 2006 11:36:49 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 6297 invoked by uid 500); 17 Sep 2006 11:36:48 -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 6286 invoked by uid 99); 17 Sep 2006 11:36:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Sep 2006 04:36:48 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mrs.nospam@gmail.com designates 64.233.182.186 as permitted sender) Received: from [64.233.182.186] (HELO nf-out-0910.google.com) (64.233.182.186) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Sep 2006 04:36:41 -0700 Received: by nf-out-0910.google.com with SMTP id b2so2414912nfe for ; Sun, 17 Sep 2006 04:36:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=F5P2lb4gp+Cov+myG62NdSt+zyKyQW6ac+OgHB/ItHEgKCm+vJBio4UTLMtFLxNKrglnIdpqFPo55zFBJoPS8p4r3Fk0aHJpHySIe/x8xWqVD83QfaJNwuO9xsasuJ4dakILxW/lqCgqo4UElLPNAnUYsm3P7WSgAe0Iewy+6GQ= Received: by 10.49.8.15 with SMTP id l15mr15706777nfi; Sun, 17 Sep 2006 04:36:14 -0700 (PDT) Received: by 10.48.210.6 with HTTP; Sun, 17 Sep 2006 04:36:14 -0700 (PDT) Message-ID: Date: Sun, 17 Sep 2006 07:36:14 -0400 From: "no spam" To: java-user@lucene.apache.org Subject: Re: default AND operator In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_112313_23513572.1158492974194" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_112313_23513572.1158492974194 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline When I use "french AND antiques" I get documents like this : score: 1.0, boost: 1.0, cont: French Antiques score: 0.23080501, boost: 1.0, cont: FRENCH SEPTIC score: 0.23080501, boost: 1.0, cont: French & French Septic score: 0.20400475, boost: 1.0,id: 25460, cont: French & Associates As in the first e-mail the Query object shows these terms: contents:french contents:antiqu <---- using string "french AND antiques" when using Operator.AND it shows these: +contents:french +contents:antiqu <----- here I used used "french antiques" The second example below matches NONE of the documents above and in fact only if I do synonym expansion with stemming. *****My big question here is why doesn't the operator.AND force both of these queries to be identical? These will be users typed queries so I want Lucene to force the use of AND so I don't have to search/replace On 9/16/06, Chris Hostetter wrote: > > can you be more specific about what it is you "expect", and what exactly > serachTerms is in your examples? (presumably it's a string, is it the > string "french AND antiques" ... are you sure it's not "french and > antiques" ? ... QueryParser only respects AND and OR if they are > capitalized, otherwise they are treated as normal words, which are > probably StopWords to your analyzer .. in which case everything you've > shown makes perfect sense to me.) > > > : > : stemParser = new QueryParser("contents", stemmingAnalyzer); > : Query query = stemParser.parse(searchTerms); > : Hits docHits = searcher.search(query); > : > : Debug from query shows: contents:french contents:antiqu ... I would > have > : expected to see '+' before contents. > : > : But not if I try the query again with "french antiques" with this code > ... > : which sets the default operator to AND: > : > : stemParser = new QueryParser("contents", stemmingAnalyzer); > : stemParser.setDefaultOperator(QueryParser.Operator.AND); > : Query query = stemParser.parse(searchTerms); > : Hits docHits = searcher.search(query); > : > : Debug from Query shows this: +contents:french +contents:antiqu > : > > > > -Hoss > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ------=_Part_112313_23513572.1158492974194--