I suspect the final query structure isn't what you think it is ... take a look at the toString on your query.
in general, there is no way to just do a "NOT foo" type query ... prohibiting things only makes sense in the context of selecting something else ... i'm guessing the query structure you acctually have is... name:xyz -name:xyz ...which means positively select anything matching name:xyz and then prohibit anything matching name:xyz ... hence the empty set. if you truely want a "NOT foo" style clause which you can then combine with other queries in a true boolean set fashion, you'll need to use a MatchAllDocs query or soemthing like it... name:xyz (field_every_doc_has_set_to_true:true -name:xyz) : Date: Tue, 23 May 2006 14:47:32 +0530 : From: "Satuluri, Venu_Madhav" <[EMAIL PROTECTED]> : Reply-To: java-user@lucene.apache.org : To: java-user@lucene.apache.org : Subject: ORing complementary queries gives no results : : Hi all, : : I build Query objects programmatically. I do this by getting a : TermQuery/PhraseQuery/whatever for each term in the user query, make a : BooleanClause by specifying isRequired and isProhibited depending on : whether the term has an "and" or an "or" or an "or not" etc prefixed : before it (I use 1.4.3, which is why I use isRequired, isProhibited : instead of BooleanClause.OCCUR). I combine all the BooleanClauses in the : end to get my final Query. : : This is working fine, except for one case where I ORed two complementary : queries, i.e. I searched for "name:xyz or -name:xyz". Both of these : queries independently produce results but both joined together don't. : The isRequired parameter is false for both the parts of the query, while : isProhibited is true for the second and false for the first. Shouldn't : this query return all the documents which have some value of the field : "name"? : : Thanks, : Venu : : --------------------------------------------------------------------- : To unsubscribe, e-mail: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]