无法编译的源代码 - 错误的符号类型:org.apache.lucene.document.FieldType.setIndexed 索引 pdf 文件时出错

Uncompilable source code - Erroneous sym type: org.apache.lucene.document.FieldType.setIndexed when indexing pdf files error

我正在尝试在 lucene 6.6.0 和 pdfbox 2.0.7 中索引 pdf 文件 我收到一些以下错误。 (已编辑)

run:
    Indexing ke folder: 'D:\Kuliah\rancangan document indexing\dir-index\'...
    Indexing PDF document: D:\Kuliah\rancangan document indexing\dir-pdf\dua.pdf
    Exception in thread "main" java.lang.ExceptionInInitializerError
        at tigasepuluh.Playground.indexDocs(Playground.java:110)
        at tigasepuluh.Playground.indexDocs(Playground.java:88)
        at tigasepuluh.Playground.main(Playground.java:65)
    Caused by: java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: org.apache.lucene.document.FieldType.setIndexed
        at org.apache.pdfbox.examples.lucene.LucenePDFDocument.<clinit>(LucenePDFDocument.java:123)
        ... 3 more
    C:\Users\abc\AppData\Local\NetBeans\Cache.2\executor-snippets\run.xml:53: Java returned: 1
    BUILD FAILED (total time: 5 seconds)

这是 github link 我的完整代码

my complete code

在您的 org.apache.pdfbox.examples.lucene.LucenePDFDocument 副本中更改此行:

TYPE_STORED_NOT_INDEXED.setIndexed(false);

TYPE_STORED_NOT_INDEXED.setIndexOptions(IndexOptions.NONE);

您遇到的问题是因为 PDFBox 示例是为 lucene 4 制作的。