【发布时间】:2012-09-04 15:36:22
【问题描述】:
我的问题与下一个代码sn-p有关:
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...
}
在这个测试中,我打开了一个 IndexWriter 没有关闭它——所以即使在测试退出后,write.lock 文件仍然存在于索引目录中,所以我希望下次我打开一个 IndexWriter 的实例到那个索引, LockObatinFailedException 将被抛出。
有人可以向我解释为什么我错了吗?我的意思是,write.lock 文件的含义是否只是保护在同一进程中创建两个 IndexWriters?这对我来说似乎不是正确的答案......
【问题讨论】:
标签: lucene lucene.net