Lucene .NET IndexWriter lock
Posted
by
Pini Salim
on Stack Overflow
See other posts from Stack Overflow
or by Pini Salim
Published on 2012-09-04T15:36:22Z
Indexed on
2012/09/04
15:38 UTC
Read the original article
Hit count: 238
lucene
|lucene.net
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...
© Stack Overflow or respective owner