开发者

Solr ExtractingRequestHandler giving empty content for pdf documents

开发者 https://www.devze.com 2022-12-15 07:10 出处:网络
I am using ExtractingRequestHandler in Solr for getting document content and index it. It works fine for all Microsoft Documents, but for PDFs, the content being extracted is empty. I have also tried

I am using ExtractingRequestHandler in Solr for getting document content and index it. It works fine for all Microsoft Documents, but for PDFs, the content being extracted is empty. I have also tried the extractOnly=true with curl, and that also return开发者_高级运维s just the empty body.

I have used TIKA independently on the same documents and that extracts content just fine. The difference is when doing independently I am using BodyContentHander that comes with Tika instead of SolrContentHandler which is used by Solr. Has anybody seen this?

I would really rather let Solr handle it than me using Tika to extract content outside of Solr.


I just dealt with this problem for hours before figuring it out -- I was opening my PDFs in an non-binary mode, and feeding them to solr only up to the first EOF character in the file. Solr will still extract the metadata from the file (as it appears in the header of the PDF), but will return an empty body tag in its response.

This may not apply to the original poster, but it may really help someone else from wasting hours of their life.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号