Java Mailing List Archive

http://www.java2.5341.com/

Home » java-user.lucene »

Reopen IndexReader

Ganesh - yahoo

2008-11-18

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello all,

I am using version 2.4. The following code throws AlreadyClosedException

    IndexReader reader = searcher.getIndexReader();
    IndexReader newReader = reader.reopen();
    if (reader != newReader) {
       reader.close();
       boolean isCurrent = newReader.isCurrent(); //throws exception
    }

Full list of exception:
--------------------
org.apache.lucene.store.AlreadyClosedException: this Directory is closed
    at org.apache.lucene.store.Directory.ensureOpen (Directory.java:220)
    at org.apache.lucene.store.FSDirectory.list (FSDirectory.java:320)
    at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:533)
    at
org.apache.lucene.index.SegmentInfos.readCurrentVersion (SegmentInfos.java:366)
    at
org.apache.lucene.index.DirectoryIndexReader.isCurrent (DirectoryIndexReader.java:188)
    at MailIndexer.IndexSearcherEx.reOpenDB(IndexSearcherEx.java:102)

Please correct me, if i am wrong.

Regards
Ganesh

Send instant messages to your online friends http://in.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@(protected)
For additional commands, e-mail: java-user-help@(protected)

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.