Apache SOLR index or retrieve the node a file is attached to I'm building a search engine with Apache SOLR (8.7.0) where PDF files are indexed and searched through, that part is working (with search_api_attachments in case you're wondering). However, the client wants to show a link to the node where this file was referenced from. This is using plain file fields, no media library. Is there a way to either index the node ID with the file, or get this reference somehow in the view with a relationship or something? Spent a good day on it but couldn't figure it out, maybe I'm just overlooking it. Or is this something that would require me writing a custom hook to add the field to the index? (it seems like quite a general use case to me though)
I am not sure if this can be done with a generic file field. It could be possible if it was a media or entity reference field. I think the simplest approach is to use hook_search_api_solr_documents_alter to find and add the node ID to the document when it is being indexed.
You can, possibly, then use the new field to create a relationship to Node table in the view to display the link or simply handle it on the theme level.