Reputation: 13
how to unlock the index directory in lucene api 3.0
when using with the SimpleFsFactory
in java?unlock()
method is not working.i am new to using the lucene
?
Upvotes: 1
Views: 4831
Reputation: 26713
I am doing it like this and it works for me:
Directory directory = FSDirectory.open(folder);
if (directory.fileExists(IndexWriter.WRITE_LOCK_NAME)) {
directory.clearLock(IndexWriter.WRITE_LOCK_NAME);
log.warn("Existing write.lock at [" + folder.getAbsolutePath() + "] has been found and removed. This is a likely result of non-gracefully terminated server. Check for index discrepancies!");
}
directory.close();
Upvotes: 6