1

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) は、エラーでこれらのインデックス ファイルを開くことができません: Format version is not supported (リソース: SimpleFSIndexInput (path="D:\myProjectPro\Java\createIndex\product_0.tvx")): 1 (0 から 0 の間である必要があります)。

何か案は?前もって感謝します。

4

2 に答える 2

0

私はLukeにあまり詳しくありませんが、このバージョンのLukeは、用語ベクトルがペイロードをサポートする前に構築されているようです(tvxバージョン番号が0から1に上がった場合)。https://issues.apache.org/jira/を参照してください。参照/LUCENE-1888

于 2013-01-03T14:44:38.227 に答える
0

この問題はバージョンの不一致であると思います。最新の Luke のように見えます - lukeall-4.0.0-ALPHA は Lucene 4.0 ALPHA ビット (2012 年 7 月) でのみビルドされており、公式の Lucene 4.0 リリース (2012 年 10 月) を使用してインデックスを作成していると思います。この時点で、次の 2 つの選択肢があると思います。

  1. Lucene 4.0 ALPHA を使用してインデックスを作成します。Lucene Archivesから jar を取得します。
  2. ソース変更 r86にチェックインされた Luke の BETA バージョンのようです。最新のソース コードを取得し、Luke をローカルでビルドして、ベータ版を試してみてください。
于 2013-01-03T13:13:56.863 に答える