I'm getting this exception when running some code to add text to a Lucene.net index:
The process cannot access the file 'E:\SomeProject\SomeProject.Webroot\App_Data\Lucene\segments.new' because it is being used by another process.
What's the easiest way of finding out what the 'other process' is? (I'm running on Win XP) Here's a stripped down code fragment (the exception is being thrown by the 'AddDocument' line after 50+ iterations) in case that's any help:
using l = Lucene.Net;
public void IndexText(List<TextToIndex> textToIndexList)
{
l.Analysis.Standard.StandardAnalyzer standardAnalyzer =
new l.Analysis.Standard.StandardAnalyzer();
l.Index.IndexWriter indexWriter =
new l.Index.IndexWriter(_LuceneIndexPath, standardAnalyzer, false);
foreach (TextToIndex textToIndex in textToIndexList)
{
l.Documents.Document luceneDoc =
CreateLuceneDoc(textToIndex.TypeId,
textToIndex.TextId,
textToIndex.Text,
textToIndex.Title,
textToIndex.ModifiedDate,
textToIndex.CultureCode);
indexWriter.AddDocument(luceneDoc);
}
indexWriter.Close();
}