不可编译的源代码 - 错误的sym类型:org.apache.lucene.document.FieldType.setIndexed索引PDF文件时出现错误
问题描述:
即时通讯尝试索引pdf文件在lucene 6.6.0和pdfbox 2.0.7 即时通讯获得一些以下错误。 (修改)不可编译的源代码 - 错误的sym类型:org.apache.lucene.document.FieldType.setIndexed索引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的链接到我的完整代码
答
更改这一行你org.apache.pdfbox.examples.lucene.LucenePDFDocument的副本:
TYPE_STORED_NOT_INDEXED.setIndexed(false);
到
TYPE_STORED_NOT_INDEXED.setIndexOptions(IndexOptions.NONE);
您遇到的问题是因为PDFBox示例是针对lucene 4制作的。
请将代码和错误消息作为文本发布。 –
感谢您的回复。对不起。 – ridhopratama
回答你在DM中提出的问题(关于LucenePDFDocument.java) - 是的,将它复制到src目录中。但是,显然你必须调整包声明/或移动文件。 Netbeans会建议做什么。 –