lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Why does BooleanQuery$TooManyClauses extend RuntimeException?
Date Wed, 26 Nov 2003 12:08:44 GMT
On Wednesday, November 26, 2003, at 06:51  AM, Otis Gospodnetic wrote:
> Hm, I'm not sure if I like this change.
> Yes, this change makes it easier to handle TooManyClauses exception,
> but the cause exception has nothing to do with parsing, and wrapping it
> in ParseException hides that.

It sort of does have something to do with the parsing though.... in 
that something the user typed parsed to an invalid query.

> I prefer leaving things like before.  Anyone who uses Lucene for
> serious business should have read the Javadoc for various queries, and
> not just the QueryParser, so complaining that this is only documented
> in BooleanQuery javadoc is not a good excuse, IMHO.

I tend to disagree with this.  And perhaps it has to do with my 
opinions on exceptions.  Runtime exceptions are pretty rude if they 
were meant to be caught.  QueryParser is for attaching a UI for user 
entered queries.

I would agree with you more if TooManyClauses was a checked exception 
so that it would have to be dealt with for developers using QueryParser.

> Furthemore, anyone who uses QueryParser should know that ParseException
> will be thrown every once in a while, when users enter a query with
> invalid syntax, and such.  Entering a Prefix or Wildcard query that
> results in more than 1024 BooleanQueries is not the result of invalid
> query syntax, but indicates a different problem, which those running
> the Lucene-based application may want to know about and handle
> differently.
>
> What do you think?

I still think the only thing that should come from the parse method is 
a ParseException, unless it is truly a runtime exception that could not 
be handled any other way.

I'm fine backing it out if that is the consensus, but I personally as a 
user of QueryParser myself am not fond of the mysterious runtime 
exceptions thrown from within Lucene's codebase propagating all the way 
back out rather than being wrapped.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message