I am in a tight loop adding items into my index. After running for a couple
minutes in the loop just fine, I get the error posted below. If I then step
through (don't stop the debugger, just hit F10 to keep stepping), it adds
just fine. If I let it run, it will get the error again immediately. If I
keep stepping through, though, I get no error. Only when it is running
continuously.
I added a sleep statement in my attempt to "program by coincidence" but it
had no effect. Here is the code I am executing. The error is below that. The
error occurs on the iw.AddDocument line:
public static void AddPostsToIndex(List<Post> posts)
{
IndexWriter iw = GetIndexWriter();
foreach (Post post in posts)
{
DateTime loopItemStart = DateTime.Now;
iw.AddDocument(post.ToDocument());
System.Threading.Thread.Sleep(10);
log.DebugFormat("Added post for feedItem {0} in {1}", post.FeedItemId,
DateTime.Now.Subtract(loopItemStart));
}
iw.Close();
}
System.IO.FileNotFoundException was unhandled
Message="Could not find file 'C:\\FeedReader\\FullTextSearch\\_oy.fnm'."
Source="mscorlib"
FileName="C:\\FeedReader\\FullTextSearch\\_oy.fnm"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share)
at Lucene.Net.Store.FSIndexInput.Descriptor..ctor(FSIndexInput
enclosingInstance, FileInfo file, FileAccess mode)
at Lucene.Net.Store.FSIndexInput..ctor(FileInfo path)
at Lucene.Net.Store.FSDirectory.OpenInput(String name)
at Lucene.Net.Index.FieldInfos..ctor(Directory d, String name)
at Lucene.Net.Index.SegmentReader.Initialize(SegmentInfo si)
at Lucene.Net.Index.SegmentReader.Get(Directory dir, SegmentInfo si,
SegmentInfos sis, Boolean closeDir, Boolean ownDir)
at Lucene.Net.Index.SegmentReader.Get(SegmentInfo si)
at Lucene.Net.Index.IndexWriter.MergeSegments(Int32 minSegment, Int32
end)
at Lucene.Net.Index.IndexWriter.MergeSegments(Int32 minSegment)
at Lucene.Net.Index.IndexWriter.MaybeMergeSegments()
at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer
analyzer)
at Lucene.Net.Index.IndexWriter.AddDocument(Document doc)
at FullTextSearch.Tasks.IndexManager.AddPostsToIndex(List`1 posts)
at FullTextSearch.Tasks.IndexManager.ValidateIndex()
at Indox.Program.RefreshDocsInIndex() in
C:\Dev\WebSites\FeedReader\FullTextSearch\System\Indox\Program.cs:line 61
at Indox.Program.HandleArguments(String[] args) in
C:\Dev\WebSites\FeedReader\FullTextSearch\System\Indox\Program.cs:line 40
at Indox.Program.Main(String[] args) in
C:\Dev\WebSites\FeedReader\FullTextSearch\System\Indox\Program.cs:line 23
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
--
-
P