lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <>
Subject Re: Using NOT queries inside parentheses
Date Tue, 07 Mar 2006 00:22:16 GMT
Satuluri, Venu_Madhav wrote:
> Hi,
> The following query does not work as expected for me:
> "alwaysTrueField:true (-name:john)"
> neither does this:
> "alwaysTrueField:true +(-name:john)"
> It returns zero results, despite there being many documents without name
> john. (alwaysTrueField is, needless to say, true for all documents).

If you want this to work, the most elegant way I've found is to override 
the getBooleanQuery(Vector) method in QueryParser and insert a 
MatchAllDocsQuery into the boolean query if every clause is prohibited.


Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message