简体   繁体   English

Lucene.net IndexWriter锁获取

[英]Lucene.net IndexWriter lock obtains

been pulling hair out for several hours trying to find a way around a limitation to Lucene.Net (2.9.2)'s FSLock problem. 数小时以来一直在努力寻找解决Lucene.Net(2.9.2)FSLock问题限制的方法。

Basically, identified that whenever a write action against the index is performed a lock gets put on the directory, nothing new. 基本上可以确定,只要执行针对索引的写操作,就会在目录上放置一个锁,没有新内容。 This lock should be released after every addition, but IndexWriter.Unlock just does nothing, so finally figured out that I can release the lock via: 每次添加后都应释放该锁,但是IndexWriter.Unlock却什么也没做,所以最终弄清楚了我可以通过以下方式释放锁:

FSDirectory.GetLockFactory().ClearLock("write.lock");

however, as soon as I try and ensure that my IndexWriter instance has been initialized, do I get a NativeFSLock exception, assuming that the IndexWriter still believes that a lock is persistent on the directory. 但是,一旦我尝试确保我的IndexWriter实例已初始化,我是否会得到NativeFSLock异常,前提是IndexWriter仍然认为目录上的锁是持久的。

Any ideas as to how I can overcome this? 关于如何克服这个问题有什么想法吗?

Thanks, Eric 谢谢,埃里克

我的IndexWriter实例不是线程安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM