I made a simple patch (against 7.x-1.0) to allow extraction/indexing of remote URLs in file fields. I tested by manually changing a row in the file_managed table to point to a Word doc on the Internet, and it worked (though of course that's only very basic testing).
Is there any chance of this functionality making it into the main codebase?
EDIT: See also #2652920: working with s3 file system
Comments
Comment #1
feedbackloop commentedsee next comment
Comment #2
feedbackloop commentedSecond pass: I realized I really needed the remote stream wrapper module. This new patch at least maintains the current behavior UNLESS you have that module installed, in which case it fetches the data into a temporary file and passes *that* to Tika/Solr.
I did testing with the remote file source module to plug in PDFs and DOCs from the Internet.
Comment #3
nick_vhThe patch is not in the correct format, could you re-roll that?
Comment #4
nick_vhComment #5
pwolanin commentedAlso, this is not the correct behavior. The stream wrapper should have a flag itself indicatiing whether it's local. See: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/...
http://api.drupal.org/api/drupal/includes!stream_wrappers.inc/constant/S...
We should copy to tmp based on that flag for a given scheme (i.e.is/t not local), NOT on this particular module name.
Comment #6
omaster commentedWhat is the status on this. I really could use this working. And the patch files really make no sense from what I can see. Not in the right format.
Comment #7
nick_vhYou could start by trying to see what that patch changes and make a decent patch for it?
Comment #8
omaster commentedYeah I probably will do that. I was just hoping that seeing as it was sooo many months ago something had happened with it. But I guess not.
Comment #9
omaster commentedDefinitely not easy. Not only do I have to work out where they go but have to figure how the latest version has changed from 1.0.
Would it be easy if I worked out where they used to be in 1.0. And then we can work out how to re factor them for the current version by where the processes have moved to?
Comment #10
TheOptimizer commentedBased on previous patches, I have made a patch that integrates Apache Solr Attachments with Remote stream wrapper files as well. It simply pulls in the remote file to a local temporary managed file. This local file can then be indexed. The garbage collector afterwards takes care of removing this temporary file.
This patch should work against the latest version.
Comment #11
TheOptimizer commentedComment #12
OliverColeman commentedAttached is a patch that allows indexing local or remote files, doesn't require the Remote Stream Wrapper module, and makes sure the file is only downloaded once from the remote storage (whether tika is used locally or via solr). It borrows code from the patch in #10 (thanks!).
Comment #13
pwolanin commentedSome code style problems like:
Could use some more comments, and I'm wondering if the some of the logic should be split out into separate functions for readability.
Comment #14
janusman commentedAnother problem is that this fetches the remote file into memory, which will cause PHP out of memory errors under many cases. Ideally this might need a way to fetch chunks of that data directly into the temporary file instead of keeping all in memory.
Perhaps using cURL (http://php.net/manual/en/book.curl.php) and saving to the file from there (similar to http://php.net/manual/en/function.curl-setopt.php#92522 ) could work?
Comment #15
amonteroSee related issue: #2652920: working with s3 file system