我试图在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\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 5 seconds)
这是我完整代码的github链接
答案 0 :(得分:1)
更改org.apache.pdfbox.examples.lucene.LucenePDFDocument副本中的这一行:
TYPE_STORED_NOT_INDEXED.setIndexed(false);
到
TYPE_STORED_NOT_INDEXED.setIndexOptions(IndexOptions.NONE);
您遇到的问题是因为PDFBox示例是针对lucene 4进行的。