lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Lucene Javadoc Exception - cause?
Date Fri, 02 Feb 2007 00:55:52 GMT
Well, in the normal course of events, things like deleteDocuments(Term)
shouldn't throw an exception unless I've screwed up. In my experience,
Lucene usually gracefully handles "normal" error cases. In this case, there
not being any underlying documents that match on Term is, I believe, handled
by just returning 0 for the documents deleted.

If the underlying Directory is closed, say, or the index is corrupted or you
might get an error thrown. Neither would be safe to ignore.

Except for a single case in my experience, exceptions are thrown by Lucene
because of a failure that retrying won't solve and ignoring would be a bad
idea. Good programming practice precludes throwing exceptions for
*recoverable* problems.

The only case I can remember where Lucene threw what I thought was an
inappropriate exception was calling a WildcardEnum with a term that had no
wildcard, and that's since been fixed in the trunk.

catching and ignoring errors is not something I'd recommend unless there is
*good* reason to believe that the underlying cause will fix itself. That's
much more common in, say, communications programs where the network can be
flaky than it is in programs like Lucene.


On 2/1/07, Josh Joy <> wrote:
> Hi,
> I was implementing some calls to Lucene, though was
> curious if there was
> some documentation I was missing that indicated why a
> method throws an
> exception.
> Example, IndexReader - deleteDocuments() - what is the
> root cause as to
> why it throws IOException?
> I'm trying to utilize this info to determine my
> exception handling
> strategy for all my Lucene API calls (should I fail,
> retry, ignore, etc)
> Thanks,
> Josh
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message