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 org.apache.lucene.search.Hits. 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. Morus --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
