我使用Lucene4.0制作索引文件:
File directorycreate = new File(indexpath);
Directory dir = new SimpleFSDirectory(directorycreate);
Analyzer analyzer = new IKAnalyzer(true);
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_40, analyzer);
IndexWriter writer = new IndexWriter(dir,conf);
Document document = new Document();
FieldType fieldtype = new FieldType();
fieldtype.setIndexed(true);
fieldtype.setTokenized(true);
fieldtype.setStored(true);
fieldtype.setStoreTermVectorPositions(true);
fieldtype.setStoreTermVectors(true);
document.add(new Field("title",name,fieldtype));
document.add(new Field("content",description,fieldtype));
document.add(new Field("contenttype", "product",TextField.TYPE_STORED));
document.add(new Field("doctype","product",TextField.TYPE_STORED));
This is my index files:
2013/01/03 10:49 <DIR> .
2013/01/03 10:49 <DIR> ..
2013/01/03 10:49 20 segments.gen
2013/01/03 10:49 69 segments_1
2013/01/03 10:49 16,566,094 _0.fdt
2013/01/03 10:49 526,786 _0.fdx
2013/01/03 10:49 459 _0.fnm
2013/01/03 10:49 357 _0.si
2013/01/03 10:49 307,358 _0.tvd
2013/01/03 10:49 17,926,810 _0.tvf
2013/01/03 10:49 1,053,537 _0.tvx
2013/01/03 10:49 2,946,878 _0_Lucene40_0.frq
2013/01/03 10:49 2,548,982 _0_Lucene40_0.prx
2013/01/03 10:49 18,903 _0_Lucene40_0.tim
2013/01/03 10:49 332 _0_Lucene40_0.tip
2013/01/03 10:49 165 _0_nrm.cfe
2013/01/03 10:49 329,336 _0_nrm.cfs
但是 lukeall-4.0.0-ALPHA.jar (http://code.google.com/p/luke/downloads/list) 无法打开这些索引文件,出现错误:不支持格式版本(资源:SimpleFSIndexInput (path="D:\myProjectPro\Java\createIndex\product_0.tvx")):1(需要在 0 和 0 之间)。
有任何想法吗?提前致谢。