Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 62928 invoked from network); 9 Oct 2007 07:56:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2007 07:56:30 -0000 Received: (qmail 71479 invoked by uid 500); 9 Oct 2007 07:56:11 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 71443 invoked by uid 500); 9 Oct 2007 07:56:11 -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 71432 invoked by uid 99); 9 Oct 2007 07:56:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 00:56:11 -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: local policy) Received: from [213.39.232.201] (HELO moskovskaya.fh-wedel.de) (213.39.232.201) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 07:56:12 +0000 Received: from di by moskovskaya.fh-wedel.de with local (Exim 4.50) id 1If9wR-0007Cn-T6 for java-user@lucene.apache.org; Tue, 09 Oct 2007 09:55:47 +0200 Date: Tue, 9 Oct 2007 09:55:47 +0200 From: Martin Dietze To: java-user@lucene.apache.org Subject: Weird operator precedence with default operator AND Message-ID: <20071009075547.GA27648@fh-wedel.de> Reply-To: Martin Dietze MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) Sender: Martin Dietze X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: di@mail.fh-wedel.de X-Virus-Checked: Checked by ClamAV on apache.org Hi, I've been going nuts trying to use LuceneParser parse query strings using the default operator AND correctly: String queryString = getQueryString(); QueryParser parser = new QueryParser("text", new StandardAnalyzer()); parser.setDefaultOperator(QueryParser.AND_OPERATOR); try { Query q = parser.parse(queryString); LOG.info("q: " + q.toString()); /* [...] */ Here's two example queries and the results I get with and without the `setDefaultOperator()' statetment: Query: hose AND cat:Wohnen cat:Mode OR color:blau - Default-Op OR: (+text:hose +cat:Wohnen) cat:Mode color:blau - Default-Op AND: +(+text:hose +cat:Wohnen) cat:Mode color:blau Query: hose AND ( cat:Wohnen cat:Mode ) OR color:blau - Default-Op OR: (+text:hose +(cat:Wohnen cat:Mode)) color:blau - Default-Op AND: (+text:hose +(+cat:Wohnen +cat:Mode)) color:blau It seems like theparser handles the default case well, but what I get with the default operator set to AND is completely incorrect. I've seen this behaviour with both version 2.1.0 and 2.2.0. Any hints? Cheers, Martin -- ----------- / http://herbert.the-little-red-haired-girl.org / ------------- =+= I got it good, I got it bad. I got the sweetest sadness I ever had. --- the The --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org