Menu

#5 RAMDirectory.files hash-key bug?

open
nobody
None
5
2014-08-14
2005-02-07
No

Hi,

I'm using Lucene.Net-1.4.3.RC2-001.

Store.RAMDirectory has a bug (I think) in CreateFile()
method. OpenFile() method accepts filename parameter
"name" that usualy isnt FullPathName, so I think that
keys for internal System.Collections.Hashtable files
should also be that way.

I changed RAMDirectory.CreateFile() method as follows:

public override OutputStream CreateFile(System.String
name) {
RAMFile file = new RAMFile();
files[System.IO.Path.GetFileName(name)] = file;
return new RAMOutputStream(file);
}

now creating an IndexSearcher with RAMDirectory storage
works:

RAMDirectory storage = new
RAMDirectory(@"d:\www\index\2005-02-07@1200");
IndexSearcher index = new IndexSearcher(storage);

I didn't see it reported anywhere yet, so I decided to
post it here. I don't have any diffs and/or pathes yet,
just wanted to report changes I needed to do.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB