Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 93091 invoked from network); 18 Aug 2005 10:37:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Aug 2005 10:37:05 -0000 Received: (qmail 62110 invoked by uid 500); 18 Aug 2005 10:36:59 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 62088 invoked by uid 500); 18 Aug 2005 10:36:59 -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 61923 invoked by uid 99); 18 Aug 2005 10:36:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2005 03:36:58 -0700 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 [69.55.225.129] (HELO ehatchersolutions.com) (69.55.225.129) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2005 03:37:17 -0700 Received: by ehatchersolutions.com (Postfix, from userid 504) id 2C3C213E2007; Thu, 18 Aug 2005 06:36:53 -0400 (EDT) Received: from [172.16.1.101] (unknown [71.48.138.146]) by ehatchersolutions.com (Postfix) with ESMTP id 1D29713E2007 for ; Thu, 18 Aug 2005 06:36:45 -0400 (EDT) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v730) X-Priority: 3 (Normal) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <77D15601-6C15-4B8C-B212-7BBF5A2A079E@ehatchersolutions.com> Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: DEFAULT_OPERATOR_AND Date: Thu, 18 Aug 2005 06:36:52 -0400 To: java-user@lucene.apache.org X-Mailer: Apple Mail (2.730) X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on javelina X-Spam-Level: X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-5.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.1 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Aug 18, 2005, at 1:48 AM, Karthik N S wrote: > Does this mean MultiFieldQueryParser will always have to use > 'DEFAULT_OPERATOR_OR' instead of DEFAULT_OPERATOR_AND > operations. Yup, that's what I said :) > Is there any alternative in handling this processs ( other then API > 'replaceAll(" ", " AND ")' substution) Of course there are alternatives! MFQP is merely a thin layer on top of QueryParser. You're free to create Query's anyway you like. Here's one of the parse methods from MFQP: public static Query parse(String[] queries, String[] fields, Analyzer analyzer) throws ParseException { if (queries.length != fields.length) throw new IllegalArgumentException("queries.length != fields.length"); BooleanQuery bQuery = new BooleanQuery(); for (int i = 0; i < fields.length; i++) { QueryParser qp = new QueryParser(fields[i], analyzer); Query q = qp.parse(queries[i]); bQuery.add(q, BooleanClause.Occur.SHOULD); } return bQuery; } You could simply create a piece of code like that with the setOperator in there. Erik > > > Please enlighten me > > > > With regards > Karthik > > > -----Original Message----- > From: Erik Hatcher [mailto:erik@ehatchersolutions.com] > Sent: Thursday, August 18, 2005 7:09 AM > To: java-user@lucene.apache.org > Subject: Re: DEFAULT_OPERATOR_AND > > > > On Aug 17, 2005, at 2:45 AM, Karthik N S wrote: > >> Hi Lucener's >> >> Apologies.......... >> >> I have seen forms using 'DEFAULT_OPERATOR_AND' with something >> like below >> >> >>> QueryParser parser = new QueryParser( "terms", analyzer); >>> parser.setOperator(QueryParser.DEFAULT_OPERATOR_AND); >>> query = parser.parse(TextParameters); >>> >> >> How to use the DEFAULT_OPERATOR_AND when using >> MultiFieldQueryParser as below >> >> "query = MultiFieldQueryParser.parse("text",fields,analyzer);" ? >> >> [ I also searched the other Form's for same but no answers.] >> > > MultiFieldQueryParser does not adhere to the default operator > setting, and will always use OR. > > Erik > > > --------------------------------------------------------------------- > 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org