Return-Path: X-Original-To: apmail-lucenenet-user-archive@www.apache.org Delivered-To: apmail-lucenenet-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C3CCA10765 for ; Wed, 8 May 2013 16:46:38 +0000 (UTC) Received: (qmail 63811 invoked by uid 500); 8 May 2013 16:46:38 -0000 Delivered-To: apmail-lucenenet-user-archive@lucenenet.apache.org Received: (qmail 63776 invoked by uid 500); 8 May 2013 16:46:38 -0000 Mailing-List: contact user-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@lucenenet.apache.org Delivered-To: mailing list user@lucenenet.apache.org Received: (qmail 63767 invoked by uid 99); 8 May 2013 16:46:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 16:46:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.74.38.226] (HELO vsp-authed-02-02.binero.net) (195.74.38.226) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 May 2013 16:46:31 +0000 Received: from smtp01.binero.se (unknown [195.74.38.28]) by vsp-authed-02-02.binero.net (Halon Mail Gateway) with ESMTP; Wed, 8 May 2013 18:46:01 +0200 (CEST) Received: from Computron.local (s83-177-186-228.cust.tele2.se [83.177.186.228]) (Authenticated sender: sisve@devhost.se) by smtp-06-01.atm.binero.net (Postfix) with ESMTPSA id 29FDF3A188; Wed, 8 May 2013 18:46:01 +0200 (CEST) Message-ID: <518A8149.9080706@devhost.se> Date: Wed, 08 May 2013 18:46:01 +0200 From: Simon Svensson User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: user@lucenenet.apache.org CC: Omri Suissa Subject: Re: Lucene query parser multiple words References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, This does not match the behavior of QueryParser. var analyzer = new StandardAnalyzer(Version.LUCENE_30); var parser = new QueryParser(Version.LUCENE_30, "f", analyzer); var query = parser.Parse("word1 word2 word3 word4"); Should return a query matching "f:word1 f:word2 f:word3 f:word4", i.e. optional match (can be changed with parser.DefaultOperator = ...) It sounds like you're using some odd analyzer which produces odd tokens. Could you provide us with a small test case to reproduce your behavior? // Simon On 2013-05-08 18:34, Omri Suissa wrote: > When using lucene QueryParser to parse a query with multipal words i found > that the returned query is like the following: > > *query text:* > > word1 word2 word3 word4 > > *returned query:* > > content:word1 content:"word1 word2" content:"word1 word2 word3" > content:"word1 word2 word3 word4" > > The logic, as i understand it is: first word, first + second word, first + > second + third word and etc... > > This logic sound too simple for my needs. for example if the user search > the following query: > > myDoc.txt anotherDoc.txt > > the user except to get results with myDoc.txt or with anotherDoc.txt (or > both). > > but... since the logic that described the user will get only results for > "myDoc.txt" and "myDoc.txt and anotherDoc.txt" and not about anotherDoc.txt > (second word alone). > > *My code:* > > new QueryParser(Lucene.Net.Util.Version.LUCENE_30, "content", > analyzer).Parse(strQuery); > > to "see" the query i'm using the ToString() method on the query object. > > There is a way to change this behavior? (or am i missing something here?) > > > Thanks, > > Omri >