lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Why does BooleanQuery$TooManyClauses extend RuntimeException?
Date Wed, 26 Nov 2003 17:19:58 GMT
Erik Hatcher wrote:
>> When using a prefix or wildcard query (where this is most likely to 
>> occur) I don't think TooManyClauses is thrown under the parser, but 
>> rather when searching, as the query isn't rewritten until it's executed.
> If that was the case, then this test would fail, right?
>   public void testBooleanQuery() throws Exception {
>     BooleanQuery.setMaxClauseCount(2);
>     try {
>       QueryParser.parse("one two three", "field", new 
> WhitespaceAnalyzer());
>       fail("ParseException expected due to too many boolean clauses");
>     } catch (ParseException expected) {
>       // too many boolean clauses, so ParseException is expected
>     }
>   }

This test case is not a prefix or wildcard query that expands into a 
BooleanQuery.  Most folks neither change the default max clause count 
nor attempt to parse queries with more than 1000 terms.

TooManyClauses is more typically thrown under, which 
calls Query.weight() which calls Query.rewrite() which, for prefix and 
wildcard queries, constructs a new BooleanQuery and adds lots of terms 
to it.


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

View raw message