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

查看:26
本文介绍了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?

我真的宁愿让 Solr 处理它而不是我使用 Tika 提取 Solr 之外的内容.

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

推荐答案

我刚刚解决了这个问题几个小时,然后才弄清楚——我在非二进制模式下打开我的 PDF,然后只将它们提供给 solr到文件中的第一个 EOF 字符.Solr 仍会从文件中提取元数据(因为它出现在 PDF 的标题中),但会在其响应中返回一个空的正文标签.

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天全站免登陆