java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.FSDirectory@/home/<path>: files:
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:516)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:185)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:148)
at DictionaryGenerator.generateDict(DictionaryGenerator.java:24)
从异常信息我们可以大致了解到,在我们的索引目录下找不到段文件,要解决这个问题,需要从以下几个方面考虑:
1.检查你的索引目录路径是否输入正确,可能你指定了一个错误的目录,而该目录下没有段文件
2.你的lucene版本是否一致,比如你的索引目录中的索引可能是使用lucene4.x API创建,而你却试图用Lucene5.0的API去打开索引目录读取索引数据
3.检查是否是权限问题,即你是否该索引目录的读写权限,特别是在linux系统下
4.尝试使用luke打开你的索引目录,如果不能使用Luke正常浏览索引目录里面的索引,则表明你的索引数据可能已经被破坏,请修复索引或者重建索引
5.如果以上还不能解决你的问题,请在下面贴出创建索引那部分的代码