1

I used Lucene4.0 to make index files:

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

But the lukeall-4.0.0-ALPHA.jar (http://code.google.com/p/luke/downloads/list) can't open these index files with an error: Format version is not supported (resource: SimpleFSIndexInput(path="D:\myProjectPro\Java\createIndex\product_0.tvx")): 1 (needs to be between 0 and 0).

Any ideas? Thanks in advance.

Changqi Cai
  • 89
  • 1
  • 5

2 Answers2

0

I would guess this problem to be a version mismatch. Looks like the latest Luke - lukeall-4.0.0-ALPHA has only been built with the Lucene 4.0 ALPHA bits (July 2012) and I would assume you are using the official Lucene 4.0 release (October 2012) to create your index. I think at this point you have two possible options:

  1. Use Lucene 4.0 ALPHA to create your index - get the jars from the Lucene Archives.
  2. Appears to be BETA version of Luke checked into the source - change r86. Pull the latest source code, build Luke locally and tryout the BETA version.
Paige Cook
  • 22,415
  • 3
  • 57
  • 68
  • 1
    Thank you for your answer.I see what you mean, but I am begginer in Luke. So I still don't know how to solve this problem. I just wait the new version of Luke:) In addition, As your answer this problem maybe a version mismatch, and It seems the lukeall-4.0.0-ALPHA.jar does not support index file's Term Vector option, the index files can be open by Luke4.0 APLHA, If I build index file without the Term vector option. – Changqi Cai Jan 03 '13 at 13:53
  • Thanks for the update and see answer from @jpountz for details on the Term Vectors support. – Paige Cook Jan 03 '13 at 14:47
  • Thanks for reminding me. I will read that material carefully. – Changqi Cai Jan 03 '13 at 15:48
0

I'm not very familiar with Luke but it looks like this version of Luke has been built before term vectors supported payloads (when the tvx version number bumped from 0 to 1), see https://issues.apache.org/jira/browse/LUCENE-1888.

jpountz
  • 9,904
  • 1
  • 31
  • 39