Lucene .NET IndexWriter lock
- by Pini Salim
My question related to the next code snippet:
static void Main(string[] args)
{
Lucene.Net.Store.Directory d = FSDirectory.Open(new DirectoryInfo(/*my index path*/));
IndexWriter writer = new IndexWriter(d, new WhitespaceAnalyzer());
//Exiting without closing the indexd writer...
}
In this test, I opened an IndexWriter without closing it - so even after the test exits, the write.lock file still exists in the index directory, so I expected that the next time I open an instance of IndexWriter to that index, a LockObatinFailedException will be thrown.
Can someone please explain to me why am I wrong? I mean, does the meaning of the write.lock file is to protect creation of two IndexWriters in the same process only? that doesnt seems the right answer to me...