lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mindaugas Žakšauskas <>
Subject Extending QueryParser
Date Fri, 11 Jun 2010 16:46:07 GMT

I am extending QueryParser's newTermQuery and newRangeQuery methods
to make it work with NumericFields.

The problem I see with those methods is that they do not allow checked
exceptions to be thrown. What I would like to do is - if I am parsing
a query parameter (term text or a range part) which I expect to be
long and fail, I'd catch NumberFormatException and rethrow it as
ParseException. This is now impossible as superclass methods don't
have any exceptions declared.

QueryParser's methods which call newTermQuery(...) and newRangeQuery
(...) do all throw ParseException and I cannot see why these ones
shouldn't be allowed to.

Another question - is there a recommended way to extend
MultiFieldQueryParser for the same purpose? It looks like it extends
QueryParser and there is no easy way to plug own parser here.

Thanks in advance.


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

View raw message