I'm trying to set up a way to index uploaded PDFs in such a way that a user can search for a term (foo
) and get a list of all the nodes with fields that contain foo
somewhere; and once they've clicked through to a page, they should be able to search for bar
within the attached PDF and see a list of snippets along with a link to jump to that page in the PDF. In my research, I decided the best way to do this would be to write a module that splits the PDFs into individual pages with filenames that include the page number, index those new documents (along with the parent document), and build my "snippet" results from those new documents. So, for example, when I upload sample.pdf
, I get the following folder structure:
content
|
+-- sample.pdf
|
+-- sample.pdf_src
| |
| +-- sample.pdf_1.pdf
| +-- sample.pdf_2.pdf
| \-- sample.pdf_3.pdf
...
That works fine, but where I'm getting stuck is indexing those extra files. For background, I'm using Acquia's Solr module (apachesolr_search
) with the extra attachments module (apachesolr_attachments
). Is it even possible to manually index those additional files I broke out? If not, are there any other ways I can get those files into the index? Maybe attach them to the original node where the user uploaded the original PDF? I just don't want to get into a situation where I have 800 attachments to a single node because the one PDF the user uploaded contained 800 pages.
If it were possible to get page numbers out of the original upload when searching for content, that would be the most ideal situation; however, my research indicates it's not possible. I'd be happy to be proven wrong, though.