lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott ganyo <>
Subject Re: Why does BooleanQuery$TooManyClauses extend RuntimeException?
Date Wed, 26 Nov 2003 21:46:02 GMT
I have always been rather troubled by this Exception.  The truth is 
that by imposing a limitation where there was none before, this change 
is already an incompatible change to the existing API.  Hiding the fact 
that the original contract has been broken by using a RuntimeException 
to slip past the compiler seems rather wrong to me.  At least if the 
Exception was explicit, users could choose to address it or ignore it 
immediately when they compile... rather than being bit by it 
inadvertently at runtime.


On Nov 26, 2003, at 12:36 PM, Doug Cutting wrote:

> Erik Hatcher wrote:
>> Nevermind.... my test is not for prefix or wildcard query, but it 
>> does show that TooManyClauses can be thrown from QueryParser.parse, 
>> which I still feel deserves a ParseException.
> I agree.  I don't object to your patch, but just wanted to note that 
> it doesn't address the original issue.
> As for the original issue: if we change it to a checked exception, 
> unless it is a subclass of IOException, all Lucene applications would 
> have to change to accomodate this, which I don't think is acceptable.
> So, if folks would like to make this a checked exception, then I guess 
> we could make it an IOException.  But that rubs me the wrong way, as 
> it doesn't really involve i/o, but is rather more like 
> ArrayOutOfBounds, BufferOverflowException. or 
> UnsupportedOperationException, etc., which are all (unchecked) 
> subclasses of RuntimeException.  So my preference would be to leave it 
> as a RuntimeException.  This will bite a few folks who've been 
> (probably unknowingly) using prefix queries that generate over 1000 
> matches, but these folks were also about to run into mysterious 
> slowdowns and OutOfMemory exceptions.  I'd rather they got 
> TooManyClauses first, increase the limit, and then get slowdowns and 
> OutOfMemory.  That way they'll better understand why they're 
> experiencing problems.
> The fellow who originally complained was able to figure out what was 
> going on, and how to prevent it by increasing the limit.  He was just 
> unhappy that he had to change something when he upgraded.  So this is 
> was not a serious bug, just an annoyance.  Let's not force every user 
> of Lucene to update their code for an incompatible change (i.e., annoy 
> lots of people) in order to remove the annoyance of a few.
> Doug
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
The reasonable man adapts himself to the world; the unreasonable one 
persists in trying to adapt the world to himself. Therefore all 
progress depends on the unreasonable man. - George Bernard Shaw

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

View raw message