2017-10-11 96 views
0

即時通訊嘗試索引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的鏈接到我的完整代碼

my complete code

+1

請將代碼和錯誤消息作爲文本發佈。 –

+0

感謝您的回覆。對不起。 – ridhopratama

+0

回答你在DM中提出的問題(關於LucenePDFDocument.java) - 是的,將它複製到src目錄中。但是,顯然你必須調整包聲明/或移動文件。 Netbeans會建議做什麼。 –

回答

1

更改這一行你org.apache.pdfbox.examples.lucene.LucenePDFDocument的副本:

TYPE_STORED_NOT_INDEXED.setIndexed(false); 

TYPE_STORED_NOT_INDEXED.setIndexOptions(IndexOptions.NONE); 

您遇到的問題是因爲PDFBox示例是針對lucene 4製作的。

相關問題