lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cool The Breezer <techcool.ku...@yahoo.com>
Subject Re: Reopen IndexReader
Date Wed, 19 Nov 2008 05:22:12 GMT
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 <lucene@mikemccandless.com> wrote:

> From: Michael McCandless <lucene@mikemccandless.com>
> 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" <lucene@mikemccandless.com>
> > 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:
> java-user-unsubscribe@lucene.apache.org
> >>> For additional commands, e-mail:
> java-user-help@lucene.apache.org
> >>> 
> >> 
> >> 
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail:
> java-user-help@lucene.apache.org
> > 
> > Send instant messages to your online friends
> http://in.messenger.yahoo.com
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail:
> java-user-help@lucene.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail:
> java-user-help@lucene.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message