Solr ExtractingRequestHandler为pdf文档提供空内容 [英] Solr ExtractingRequestHandler giving empty content for pdf documents

查看:111
本文介绍了Solr ExtractingRequestHandler为pdf文档提供空内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Solr中使用ExtractingRequestHandler来获取文档内容并为其编制索引.它适用于所有Microsoft文档,但对于PDF,要提取的内容为空.我还尝试了curl的extractOnly = true,它也只返回空的正文.

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 returns just the empty body.

我在相同的文档上独立使用了TIKA,并且提取的内容还不错.区别在于,当我独立进行操作时,我使用的是Tika随附的BodyContentHander,而不是Solr使用的SolrContentHandler.有人看到过吗?

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?

与使用Tika在Solr之外提取内容相比,我真的更愿意让Solr处理它.

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

推荐答案

在解决这个问题之前,我已经处理了好几个小时-我以非二进制模式打开我的PDF,然后仅将它们送入solr到文件中的第一个EOF字符. Solr仍将从文件中提取元数据(如它出现在PDF的标题中一样),但将在其响应中返回一个空的body标签.

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.

这篇关于Solr ExtractingRequestHandler为pdf文档提供空内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆