: Do you know why I can't close the IndexReader explicitly under some : circumstances and why, when I do manage to close it I can still call : methods on the reader?
1) I tried to create a test case that demonstrated your bug based on the code outline you provided, and i couldn't (see below). that implies to me that somethine else is going on. If you can create a completely self contained program that demonstrates your bug and mail it to the list that would help us help you. 2) the documentation for IndexReader.close() says... Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called. ...note the word "should". it doesn't say what the other methods will do if you try to call them, just that you shouldn't try. In some cases they may generate exceptions, in other cases they may just be able to return you data based on state internal to the object which is unaffected by the fact that the files have all been closed. -Hoss public static void main(String argv[]) throws IOException { /* create a directory */ String d = System.getProperty("java.io.tmpdir", "tmp") + System.getProperty("file.separator") + "index-dir-" + (new Random()).nextInt(1000); Directory trash = FSDirectory.getDirectory(d, true); /* build index */ Document doc; IndexWriter w = new IndexWriter(d, new SimpleAnalyzer(), true); doc = new Document(); doc.add(Field.Text("words", "apple emu")); w.addDocument(doc); w.optimize(); w.close(); /* search index */ IndexReader r = IndexReader.open(d); IndexSearcher s = new IndexSearcher(r); Hits h = s.search(new TermQuery(new Term("words", "apple"))); s.close(); r.close(); System.out.println("Reader? - " + r.maxDoc()); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]