Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 2430 invoked from network); 14 Feb 2006 10:54:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Feb 2006 10:54:10 -0000 Received: (qmail 8937 invoked by uid 500); 14 Feb 2006 10:54:04 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 8676 invoked by uid 500); 14 Feb 2006 10:54:02 -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 8665 invoked by uid 99); 14 Feb 2006 10:54:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2006 02:54:02 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [143.205.118.212] (HELO proserver2.ifit.uni-klu.ac.at) (143.205.118.212) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2006 02:54:01 -0800 Received: from [143.205.118.106] ([143.205.118.106]) by proserver2.ifit.uni-klu.ac.at over TLS secured channel with Microsoft SMTPSVC(5.0.2195.6713); Tue, 14 Feb 2006 11:53:32 +0100 Message-ID: <43F1B6AB.7030603@ifit.uni-klu.ac.at> Date: Tue, 14 Feb 2006 11:53:31 +0100 From: sergiu gordea User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: QueryParser behaviour .. References: <43EC9184.1050706@ifit.uni-klu.ac.at> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Feb 2006 10:53:32.0122 (UTC) FILETIME=[E5553BA0:01C63154] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Chris Hostetter wrote: >: I built a wrong query string "word1,word2,word3" instead of "word1 >: word2 word3" >: therefore I got a wrong query: field:"word1 word2 word3" instead of >: field:word1 field:word2 field:word3. >: >: Is this an espected behaviour? >: I used Standard analyzer, probably therefore, the comas were replaced >: with spaces. > >the commas weren't replaced ... your analyzer split on them and threw >them away. > >they key to understanding why that resulted in a phrase query instead of >three term queries is that QueryParser doesn't treat comma as a special >character, so it saw the string word1,word2,word3 and gave it to your >analyzer. Since your analyzer gave back several tokens QueryParser built >a phrase query out of it. > > Exactly this is my question, why the QueryParser creates a Phrase query when he gets several tokens from analyzer and not a BooleanQuery? >likewise, in the case of "word1 word2 word3" the quotes *are* a special >character to QueryParser which tells it it should *not* split on the >spaces betwen the quotes, and hand the individual words to the analyzer. >instead it hands the whole thing to the analyzer as one big string again. > > > It was not this situation, the string was without quotes.... (String searchString = "word1,word2,word3"; ) I just preserved java quotes to delimit the string. >: Is this a bug? Does it make sense to indicate this situation through a >: Parse Exception? > >a parse error should really onl come up when the query parser sees a >character that it does consider special, but sees it in a place that >doesn't make sense (or doesn't see one in a plkace it needs one). in this >case QP is perfectly happy to let you query for a word that contains a >comma -- it's your analyzer that's putting it's foot down and saying that >can't be in a word. > > Ok .. it is not the case of ParseException, should situations like this (change from TermQuery to PhraseQuery) indicated in log files? I mean, this will help developers to debug their code easier. Best, Sergiu > >-Hoss > > >--------------------------------------------------------------------- >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