lucene 索引出错 no segments* file found in org.apache.lucene.store.MMapDirectory
来源:互联网 发布:javascript div 只读 编辑:程序博客网 时间:2024/05/17 21:58
创建第一个lucene索引后,搜索出错:
org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.MMapDirectory@H:\lucene lockFactory=org.apache.lucene.store.NativeFSLockFactory@487c9b46: 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 lucene.Searcher.search(Searcher.java:26)
at lucene.Searcher.main(Searcher.java:49)
原因:
indexer创建完索引后没有关闭(提交)导致索引没有完整创建,导致搜索报错
注意如下说明:(index.close())
public static void main(String[] args) {long start = System.currentTimeMillis();Indexer indexer = null;int numIndexed = 0;try {indexer = new Indexer(indexDir);numIndexed = indexer.index(dataDir, new TextFilesFilter());} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{try {//IndexerWriter写索引操作关闭,提交写索引(如没关闭会造成索引无法完整创建,查询时出错)indexer.close();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}long end = System.currentTimeMillis();System.out.println("\n Indexing " + numIndexed + " files took "+ (end - start) + "milliseconds");}
0 0
- lucene 索引出错 no segments* file found in org.apache.lucene.store.MMapDirectory
- no segments* file found in org.apache.lucene.store.SimpleFSDirectory
- lucene:no segments* file found in org.apache.lucene.store.FSDirectory@
- lucene 错误 no segments* file found in org.apache.lucene.store.FSDirectory@ write.lock
- lucene:no segments* file found in org.apache.lucene.store.FSDirectory@
- lucene:no segments* file found in org.apache.lucene.store.FSDirectory@
- Lucene错误:no segments* file found in org.apache.lucene.store.RAMDirectory
- luence基础学习——no segments* file found in org.apache.lu异常处理
- Lucene 使用no segments* file 异常原因
- lucene MMapDirectory的使用
- 建立索引时no segments* file found 的问题
- Lucene异常:org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
- org.apache.lucene.search.Hits.java搜索索引
- lucene RAMDirectory org.apache.lucene.index.IndexNotFoundException
- Solr/Lucene MMapDirectory的小细节
- 求解决 严重: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
- Lucene索引文件结构图之一(segments&fnm&fdx&fdt)
- #Lucene# org.apache.lucene.util.BitUtil.pop(long x) 笔记
- qt编程信号和槽连接应注意的问题
- vs2010编写mfc动态库
- Ubuntu全盘500G安装的分区选择
- Permutations
- oc与swift混编教程
- lucene 索引出错 no segments* file found in org.apache.lucene.store.MMapDirectory
- 2015-1-19
- 选择尚学堂与传智播客的java培训?
- Oracle获取系统时间及格式化
- HDU4790 Just Random 【数学】
- U-BOOT源码分析及移植 这篇文章写的不错
- iOS 学习资料整理
- HDU-candy-每次只吃一种糖
- End-to-End Workload Monitor in SAP Solution Manager