lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Garski <>
Subject RE: Port of Java Lucene 2.9 is under way
Date Thu, 15 Oct 2009 22:29:21 GMT
Interesting - we are using the latest in the trunk and are not experiencing this issue due
to how we are opening/reopening the readers:


IndexReader reader = IndexReader.Open(pathToIndex);
IndexSearcher searcher = new IndexSearcher(reader);


IndexReader newReader = searcher.Reader.Reopen();
// ensure the reader has actually changed
if(newReader != searcher.Reader)
	IndexSearcher newSearcher = new IndexSearcher(newReader);
	searcher = newSearcher;

The reader on the old searcher must be manually closed as the searcher was created with the


-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [] 
Sent: Thursday, October 15, 2009 3:04 PM
Subject: RE: Port of Java Lucene 2.9 is under way

Just to confirm I've just downloaded the version in the trunk and it’s the same version
I have in my environment.

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [] 
Sent: Thursday, October 15, 2009 3:55 PM
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line

From what I read from the post in the Lucene-Java and from debugging, the problem is that
the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories
and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string
"NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory
for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent()
it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called
because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.


-----Original Message-----
From: Michael Garski [] 
Sent: Thursday, October 15, 2009 12:42 PM
Subject: RE: Port of Java Lucene 2.9 is under way


What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons
you are and do not have any issues with it using the latest version in the trunk.


-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [] 
Sent: Wednesday, October 14, 2009 7:13 PM
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 


Best regards

-----Original Message-----
From: George Aroush [] 
Sent: Wednesday, September 16, 2009 9:32 PM
Subject: Port of Java Lucene 2.9 is under way

Hi folks,


This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.


If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.


With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.




-- George

View raw message