lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <dan...@nuix.com.au>
Subject Re: Using NOT queries inside parentheses
Date Tue, 07 Mar 2006 23:52:58 GMT
Satuluri, Venu_Madhav wrote:
>> 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
> 
> I tried this, but it looks like the overridden method
> getBooleanQuery(vector) does not get called. I am using 1.4.3.

We're using 1.4.2.

The minimalist example:

public class Test {
   public static void main() throws Exception {
     QueryParser parser = new QueryParser("text",
                                          new StandardAnalyzer()) {
       protected Query getBooleanQuery(Vector clauses)
           throws ParseException {
         System.out.println("getBooleanQuery called");
         return super.getBooleanQuery(clauses);
       }
     };
     parser.parse("-foo");
   }
}

Output of this will be:
getBooleanQuery called

If it isn't being called in your application, the likelihood is that 
you're not using the overridden query parser at all.

Daniel

-- 
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message