lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <digyd...@gmail.com>
Subject RE: IndexReader.IndexExists bug
Date Sat, 23 Feb 2008 12:06:27 GMT
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:dbera.web@gmail.com] 
Sent: Saturday, February 23, 2008 6:13 AM
To: lucene-net-user@incubator.apache.org
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


Mime
View raw message