My nodes have (links to) files inserted in the body text (using CKEditor). There are multiple revisions of these nodes with changes to those files/links as well, sometimes files were removed, sometimes a new version has been inserted/uploaded and the file got an additional _0 suffix before its extension.

If I want Search API to be able to search through those files (PDFs) as well (I use file_extractor for this), I cannot only index the node bodies themselves (at least I think so? Or can I index the files that they link to based on the content?). I need to index the whole content type "Files". And this is where all the files linked to in the old revision also get indexed which leads to search results of old, unwanted content.

I want to get rid of them but keep IT and editor interaction as low as possible.

I see a few approaches:

  • Delete old revisions and their files. I think I might find options for this, please do not discuss this at the moment. Not my preferred way, as having revisions is a good thing™.
  • Add an additional "attachments" field to nodes, make editors only upload files there and manually insert links to these attachments inline. Index only this attachment field and not all files. Cumbersome editing experience, does not solve it for existing content (which is huge for some sites). Not my preferred way either, but probably part of a solution building on this?
  • Use some module that provides this feature (which one?)
  • Correctly configure Search API so it does this (couldn't find a solution)
  • (Pay someone to) develop a module or extend Search API's processors so that only files linked to in current revisions get indexed
  • Create a view that only lists files in current revisions and index that (could not find a way as I am missing either "files linked to in this body field" if I go the content-centric route or "is linked from the latest revision" if I go the file-centric route.)

This seems to be a pretty common problem so I wonder how everyone else solves this? Am I missing something? Any pointers highly appreciated. Thanks in advance!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.