Did you create your IndexSearcher using a String or File (not Directory)?

If so, it sounds like you are hitting this issue (just fixed this morning, on 2.9-dev (trunk)):

    https://issues.apache.org/jira/browse/LUCENE-1453

The workaround is to use the Directory ctor of IndexSearcher.

Mike

Ganesh wrote:

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to