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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to