在solr中获取pdf搜索结果的页码 [英] Get page numbers of searchresult of a pdf in solr
问题描述
我正在构建一个 Web 应用程序,用户可以在其中搜索 pdf 文档并使用 pdf.js 查看它们.我想显示搜索结果,其中包含找到搜索词的段落的一小段片段以及在右侧页面打开文档的链接.
I'm building a web application where users can search for pdf documents and view them with pdf.js. I would like to display the search results with a short snippet of the paragraph where the search term where found and a link to open the document at the right page.
所以我需要的是每个搜索结果的页码和一个简短的文本片段.
So what I need is the page number and a short text snippet of every search result.
我正在使用 SOLR 4.1 来索引 pdf 文档.索引本身工作正常,但我不知道如何获取搜索结果的页码和段落.
I'm using SOLR 4.1 to index pdf documents. The indexing itself works fine but I don't know how to get the page number and paragraph of a search result.
我在这里找到了这个使用 Solr 用页码索引 PDF",但这并没有真正的帮助.
I found this here "Indexing PDF with page numbers with Solr" but it wasn't really helpfully.
推荐答案
我现在正在拆分 PDF 并将每一页分别发送到 SOLR.因此,每个页面都是一个自己的文档,具有 id <id_of_document>_<page_number>
和一个附加字段 doc_id,其中仅包含用于对结果进行分组的 <id_of_document>
.
I'm now splitting the PDF and sending each page separately to SOLR.
So every page is an own document with an id <id_of_document>_<page_number>
and an additional field doc_id which contains only the <id_of_document>
for grouping the results.
这篇关于在solr中获取pdf搜索结果的页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!