lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Reopen IndexReader
Date Tue, 18 Nov 2008 11:29:48 GMT

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


Mime
View raw message