no segments* file found in org.apache.lucene.store.SimpleFSDirectory
2016-07-03 23:49
896 查看
建立好文件索引后,再执行搜索个过程中出现了这个异常:
rg.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.SimpleFSDirectory@D:\lucene\index01 lockFactory=org.apache.lucene.store.NativeFSLockFactory@26e431: files: [write.lock, _0.fdt, _0.fdx]
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:712)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:75)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:462)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:308)
at com.lyl.test.HelloLucene.sercher(HelloLucene.java:73)
at com.lyl.test.TestLucene.search1(TestLucene.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
单元测试过程中,创建索引读取器IndexReader的时候,抛出异常,并发现索引文件都为0kb,最终确认是索引IndexWriter写入器没有将缓存中的信息输入文件内,
解决方法是:写入器添加好文件索引后,关闭写入器,就ok了!
if(writer
!=null) writer.close();
rg.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.SimpleFSDirectory@D:\lucene\index01 lockFactory=org.apache.lucene.store.NativeFSLockFactory@26e431: files: [write.lock, _0.fdt, _0.fdx]
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:712)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:75)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:462)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:308)
at com.lyl.test.HelloLucene.sercher(HelloLucene.java:73)
at com.lyl.test.TestLucene.search1(TestLucene.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
单元测试过程中,创建索引读取器IndexReader的时候,抛出异常,并发现索引文件都为0kb,最终确认是索引IndexWriter写入器没有将缓存中的信息输入文件内,
解决方法是:写入器添加好文件索引后,关闭写入器,就ok了!
if(writer
!=null) writer.close();
相关文章推荐
- Ruby中的异常处理代码编写示例
- SQL Server 2005 中使用 Try Catch 处理异常
- MySQL抛出Incorrect string value异常分析
- 浅谈C#中简单的异常引发与处理操作
- 详解C#编程中异常的创建和引发以及异常处理
- 详解JavaScript中的异常处理方法
- java程序中的延时加载异常及解决方案
- 解析Java异常的栈轨迹及其相关方法
- .NET(C#):Emit创建异常处理的方法
- windows7服务器上weblogic启动失败异常解决方法
- 有关ajax的error与后台的异常问题解决
- 深入探讨JAVA中的异常与错误处理
- java Lucene 中自定义排序的实现
- GO语言异常处理机制panic和recover分析
- 浅谈JAVA 异常对于性能的影响
- 解析C++编程中的bad_cast异常
- Java中的异常测试框架JUnit使用上手指南
- C++ 异常处理 catch(...)介绍
- 详解Oracle自定义异常示例
- php中异常处理方法小结