关于lucene的几个小问题
06-04-20 16:02 View:828
1、couldn't rename segments.new to segments异常
是由于杀毒软件一直在监控扫描系统内的变化文件,当杀软独占文件时,lucene在重命名时肯定会遇到异常。
解决方法:暂停杀软
2、Lock obtain timed out
这是由于在上一次建立索引时,出现了异常导致索引没有及时关闭和释放资源,那么此时在重新IndexReader的时候,索引打开和读取将会抛出异常。
解决方法:
String IndexPath = "";
//得到索引Directory目录
Directory directory = FSDirectory.GetDirectory(IndexPath,false);
//将该目录下的索引解锁
IndexReader.Unlock(directory);