Hi,
SegmentInfos#GetCurrentSegmentGeneration(Lucene.Net v 2.1.0.3) uses the
filenames as below
System.String file = (new System.IO.FileInfo(files[i])).Name; //<-- not
(new System.IO.FileInfo(files[i])).FullName
if (file.StartsWith(IndexFileNames.SEGMENTS) &&
!file.Equals(IndexFileNames.SEGMENTS_GEN)) .......
So, I don't think there is a bug there.
DIGY
-----Original Message-----
From: Debajyoti Bera [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 23, 2008 6:13 AM
To: [email protected]
Subject: IndexReader.IndexExists bug
Hi,
I spotted this error in IndexReader.IndexExists in Lucene.Net-2.1. Not
sure
if this is already fixed in trunk.
public static bool IndexExists(System.IO.FileInfo directory)
{
return
SegmentInfos.GetCurrentSegmentGeneration(System.IO.Directory.GetFileSystemEntries(directory.FullName))
!= -
1;
}
The above method uses Directory.GetFileSystemEntries which returns full path
of the directory contents, whereas GetCurrentSegmentGeneration expects only
names of the directory contents. As it is, IndexReader.IndexExists() will
return false even for valid indexes.
- dBera
--
-----------------------------------------------------
Debajyoti Bera @ http://dtecht.blogspot.com
beagle / KDE fan
Mandriva / Inspiron-1100 user