I had same kind of problem and I somehow managed to find a work around by initializing IndexSearcher from new reader.
try { IndexReader newReader = reader.reopen(); if (newReader != reader) { // reader was reopened reader.close(); reader = null; } reader = newReader; searcher = new IndexSearcher(newReader); } catch (Exception e) { e.printStackTrace(); } --- On Tue, 11/18/08, Michael McCandless <[EMAIL PROTECTED]> wrote: > From: Michael McCandless <[EMAIL PROTECTED]> > Subject: Re: Reopen IndexReader > To: java-user@lucene.apache.org > Date: Tuesday, November 18, 2008, 7:52 AM > Well... we certainly do our best to have each release be > stable, but we do make mistakes, so you'll have to use > your own judgement on when to upgrade. > > However, it's only through users like yourself > upgrading that we then find & fix any uncaught issues in > each new release. > > Mike > > Ganesh wrote: > > > I am creating IndexSearcher using String, this is > working fine with version 2.3.2. > > I tried by replacing Directory ctor of IndexSearcher > and it is working fine with v2.4. > > > > I have recently upgraded from v2.3.2 to 2.4. Is v2.4 > stable and i could more forward with this or shall i revert > back to 2.3.2? > > > > Regards > > Ganesh > > > > > > ----- Original Message ----- From: "Michael > McCandless" <[EMAIL PROTECTED]> > > To: <java-user@lucene.apache.org> > > Sent: Tuesday, November 18, 2008 4:59 PM > > Subject: Re: Reopen IndexReader > > > > > >> > >> 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] > > > > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]