Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 41905 invoked from network); 6 Dec 2004 20:31:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 6 Dec 2004 20:31:59 -0000 Received: (qmail 83901 invoked by uid 500); 6 Dec 2004 20:31:52 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 83878 invoked by uid 500); 6 Dec 2004 20:31:51 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 83865 invoked by uid 99); 6 Dec 2004 20:31:51 -0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=SPF_HELO_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from keyserver.Rescomp.Berkeley.EDU (HELO rescomp.berkeley.edu) (169.229.70.167) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 06 Dec 2004 12:31:50 -0800 Received: by rescomp.berkeley.edu (Postfix, from userid 1007) id 56C865B7AD; Mon, 6 Dec 2004 12:31:45 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by rescomp.berkeley.edu (Postfix) with ESMTP id 557607F460 for ; Mon, 6 Dec 2004 12:31:45 -0800 (PST) Date: Mon, 6 Dec 2004 12:31:45 -0800 (PST) From: Chris Hostetter Sender: hossman@hal.rescomp.berkeley.edu To: Lucene Users List Subject: Re: indexReader close method In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N : 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: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org