Hi Rakesh, Perhaps the confusion comes from the asymmetry between +X and -X. I.e., for the query: A B -C +D one might think that, similar to how -C only disqualifies docs containing C (but not qualifying docs not containing C), also +D only disqualifies docs not containing D. But this is inaccurate, because +D, in addition to disqualifying docs not containing D, also qualifies docs containing D.
The modified query that Steven suggested: +(A B) -C +D removes this asymmetry, because specifying +(A B) means that D is not anymore sufficient to qualify a doc. Hope this helps (otherwise let this reply be forever disqualified : - ) ) Doron On Dec 18, 2007 9:28 PM, Steven A Rowe <[EMAIL PROTECTED]> wrote: > Hi Rakesh, > > This doesn't look like a user-generated query. Have you considered > building the Query via the API instead of using QueryParser? > > With QueryParser, you should get the results you want with syntax like: > > +(i_title:indoor* OR i_description:indoor*) -i_published:false > +i_topicsClasses.id:1_1_*_* > > Have you tried this yet? > > Steve > > On 12/18/2007 at 1:58 PM, Rakesh Shete wrote: > > > > Thanks for the suggestion Steve. My problem is with getting > > the correct results. Let me put in words the query : > > > > Fetch all documents such that the search string "indoor*" is > > either part of the 'i_title' field or 'i_description' field, > > eliminate if not published (-i_published:false) but should > > have topic id of the form "1_1_*_*" (i_topicsClasses.id:1_1_*_*) > > > > i_title:indoor* i_description:indoor* -i_published:false > > +i_topicsClasses.id:1_1_*_* returns me extra results which > > should not be fetched. > > > > -- Regards, > > Rakesh Shete > > > > > Subject: RE: Lucene multifield query problem > > > Date: Tue, 18 Dec 2007 13:26:24 -0500 > > > From: [EMAIL PROTECTED] > > > To: java-user@lucene.apache.org > > > > > > Hi Rakesh, > > > > > > Set the default QueryParser operator to AND (default default operator > > > :) is OR): > > > > > > > > <http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/que > > ryParser/QueryParser.html#setDefaultOperator(org.apache.lucene > > .queryParser.QueryParser.Operator)> > > > > > > Steve > > > > > > On 12/18/2007 at 1:22 PM, Rakesh Shete wrote: > > > > > > > > Hi all, > > > > > > > > I am facing problem with the following multifield query: > > > > > > > > i_title:indoor* i_description:indoor* -i_published:false > > > > +i_topicsClasses.id:1_1_*_* > > > > > > > > The above query returns me even results which should not be > > > > there. Ideally I would like the query resullts as: > > > > > > > > (i_title:indoor* i_description:indoor* -i_published:false) > > > > AND (i_topicsClasses.id:1_1_*_*) > > > > > > > > i.e. The intersection of the first part and second part. > > > > > > > > But what is happening currently is that I get a union of the > > > > first part and second part, i.e., whatever results are > > > > returned by "i_title:indoor* i_description:indoor* > > > > -i_published:false" are combined (union) with results > > > > returned by "+i_topicsClasses.id:1_1_*_*". > > > > > > > > How do I write a query that returns me results which are an > > > > intersection of the above 2 parts? > > > > > > > > --Regards, > > > > Rakesh S > > > > > > > > > > > > _________________________________________________________________ > Post > > > > ads for free - to sell, rent or even buy.www.yello.in > > > > http://ss1.richmedia.in/recurl.asp?pid=186 > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] For > > > additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > _________________________________________________________________ Post > > ads for free - to sell, rent or even buy.www.yello.in > > http://ss1.richmedia.in/recurl.asp?pid=186 > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >