lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <>
Subject Re: indexReader close method
Date Tue, 07 Dec 2004 07:30:35 GMT
Helen Warren writes:
> //close the IndexReader object
> myReader.close();
> //return results
> return hits;
> The myReader.close() line causes the IOException to be thrown. To try 

Are you sure it's the myReader.close() that fails?
I'd suspect that to fail as soon as you want to do anything meaningful
with the hits objects you return. You need an open searcher/reader for that 
and in general it should be the one, you used during search. This is 
assuming hits is an instance of class
The method Document doc(int n) relys on the searcher used for search 
not being closed.
So I'd suspect the IOException to be thrown later.
Of course removing the myReader.close(); will prevent the exception.
You cannot close the reader as long as you want to access search results.

> In this case, the reader appears to close without error but even after 
> I've called myReader.close() I can execute the maxDoc() method on that 
> object and return results. Anybody shed any light?
yes. the source ;-)
maxDoc does not access the index files but returns an integer stored
in the class itself.


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

View raw message