This seems like it should be obvious, but I'm having no luck finding any reliable information on the right way to handle readers and writers in Lucene.net 3.0.3.. My understanding from the docs was that I could have a static IndexWriter that's inherently thread-safe, and I could call GetReader to get readers from that writer as-needed.
I tried this by initializing a static writer in my constructor (code below) but when I do a search against this, I get _0.cfs FileNotFound exceptions (the index is empty, i haven't saved any docs, but i do have segments_1 and segments.gen in my folder).. Is there more to initialization that I'm missing?
_luceneDir = Path.Combine(indexFolder, string.Format("{0}.index", accountId));
Console.WriteLine("Starting up search with index at {0}", _luceneDir);
if(luceneIndexDirectory == null)
luceneIndexDirectory = FSDirectory.Open(_luceneDir);
if(IndexWriter.IsLocked(luceneIndexDirectory))
IndexWriter.Unlock(luceneIndexDirectory);
if (indexWriter == null)
indexWriter = new IndexWriter(luceneIndexDirectory, standardAnalyzer, IndexWriter.MaxFieldLength.UNLIMITED);