Hi, I seem to be having an issue with Lucene (I just downloaded 2.9.4g as I
previously used 2.4) when deployed onto the cloud (Rackspace Cloud)
I suspect I do not understand optimising properly. This is the code:-
public static void IndexNews(CmsNews newsDoc)
{
directory = FSDirectory.Open(new
DirectoryInfo(Settings.LuceneBaseDir));
var writer = new IndexWriter(directory, Analyzer, false,
IndexWriter.MaxFieldLength.LIMITED);
writer.AddDocument(GetNewsDocument(newsDoc));
//writer.Optimize(); <-If I uncomment this then I get an error
writer.Close();
directory.Close();
}
public static void IndexNews(IList<CmsNews> newsList)
{
directory = FSDirectory.Open(new
DirectoryInfo(Settings.LuceneBaseDir));
var writer = new IndexWriter(directory, Analyzer, false,
IndexWriter.MaxFieldLength.LIMITED);
foreach (var item in newsList)
writer.AddDocument(GetNewsDocument(item));
writer.Optimize();
writer.Close();
directory.Close();
}
If I uncomment the above write.Optimize when I index a single document I get
the following error:-
no segments* file found in
Lucene.Net.Store.SimpleFSDirectory@\\fs1-n01\stor1wc1dfw1\381858\testing.wil
desoft.net\web\content\App_Data\LuceneIndex\
lockFactory=Lucene.Net.Store.NativeFSLockFactory: files: write.lock
If I comment the above write.Optimize then all works great.
So my questions are:-
1. Why is this happening, are we trying to optimise prematurely?
2. If so then do I need to ever worry about writer.optimise or does
the indexes eventually optimise themselves?
3. Also I noticed that there is a generics branch but cannot find any
guidance into indexing/searching. I assume that the generics are for
searching, does any exist?
This is a small scale CMS system so I will not be indexing 100's of
documents a day.
However ALL works locally on my dev box without any problems.
Many Thanks
Richard
E: <mailto:[email protected]> [email protected]
W: <http://www.wildesoft.net/> www.wildesoft.net
T: 01885 483006
M: 07884 433240
Twitter: @rippo