I was using the apachesolr_attachments module before switching to Search API, and it has the ability to offload the document processing to the Solr server by using the built-in ExtractingRequestHandler. Tika is very CPU-intensive, so getting it back off the webserver would be a big help to me.
http://wiki.apache.org/solr/ExtractingRequestHandler
http://drupal.org/project/apachesolr_attachments
Comments
Comment #1
stijndm commentedIn attachment is an updated version of the search_api_attachements module that incorporates the method used by apachesolr_attachments for indexing/parsing documents with a remote Tika library. It is not the cleanest implementation, but it works. I do recommend doing some code cleanup before committing. It also incorporates some other fixes (ie: catching exceptions when parsing) and the changes reported in #1253824: search_api callback causes undefined property errors in SearchApiAttachmentsAlterSettings.
The Solr config is the same as used by apachesolr_attachments, so you'll have to take a peak at the installation instruction of that module. The best thing to do is merge the instructions to this module.
Enjoy.
Comment #2
stijndm commentedComment #3
miiimooo@stijndm: I've activated this zip and get an error:
What version of search_api was this written for? I'm using a fairly current dev version.
Comment #4
miiimooo@stijndm: I've activated this zip and get an error:
What version of search_api was this written for? I'm using a fairly current dev version.
Comment #5
miiimooo@stijndm: I've activated this zip and get an error:
What version of search_api was this written for? I'm using a fairly current dev version.
Comment #6
regilero commentedI've made a proper patch.
Note it miss some documentations about the way to configure a remote solr extractor, I'll add this data soon.
This patch cannot work if the patch http://drupal.org/files/search_api_solr-allow_abitrary_query-1580118-1.p... (#1580118 Allow arbitrary solr requests) is not apply on the search_api_solr module.
This patch contains :
Comment #7
regilero commentedForgot to alter th status of the patch. I think this needs more reviews than work.
Comment #8
bblake commentedPatch didn't work for me, made a few changes and it now works for me.
Comment #9
pwolanin commentedMinor, but I would swap md5 for a sha2 hash function, since md5 shouldn't be used in Drupal 7+. Need to fix that in apachesolr_attachments
Comment #10
sutharsan commentedPatch fails to apply due to too many whitespace errors. Attached patch is clean.
But now the following error occurs:
The method "sendHttpRequest" is not found in the search_api (7.x-1.2) or search_ap_solr (7.x-1.0-rc2).
Comment #11
simon georges commented@Sutharsan, It's mentionned in #6 that you need the patch http://drupal.org/files/search_api_solr-allow_abitrary_query-1580118-1.p... on SearchAPI Solr to have this working.
Comment #12
sutharsan commentedI was too quick, thanks. So this issue is depending on #1580118: Allow arbitrary solr requests -- useful for search_api_attachments. Back to needs review.
Comment #13
gp.mazzola commentedHi, the new release of Search API Solr Search module, to RC4, breaks this patch. Could you update it to work with the new version? Dependency on the SolrPhpClient library has been dropped
Comment #14
andypostToo much writes to watchdog
Any reason to have different set of arguments?
looks like you send data to random server
probably this depends on solr version...
Comment #15
torpy commentedI completely rewrote this to make use of the makeServlet() function in the solr connection class as hinted by drunken monkey in #1580118: Allow arbitrary solr requests -- useful for search_api_attachments. Provided you have Solr setup properly (more instructions soon), the following patch should work.
Also, rewrote the caching logic to use Drupal's Cache API instead of the custom code that was there before.
Unfortunately, this requires the following patches to be installed in order to apply cleanly:
#1148162: Use real path instead of url to retrieve file
#1307720: Newly added node files not added properly
#1895966: Handle (Ignore) Missing Files
Comment #16
torpy commentedComment #17
torpy commentedNow with a better README.txt explaining what changes need to happen in the solr config.
Comment #18
gp.mazzola commentedHi @Torpy,
thank you for the new patch. I am trying to test it. Which version of the search_api_attachments module should I use?
I have installed the latest 7.x-1.x-dev and I also downloaded the other 3 patches that I have to apply first, according to your post.
However the first one
#1148162: Use real path instead of url to retrieve file
fails to apply.
Thank you,
GP
Comment #19
torpy commentedI used dev and the 'realpath' patch in comment #10 (https://drupal.org/files/search_api_attachments-realpath-1148162-10.patch). Just tried it, should apply fine.
Actually, looking back, I realised that this patch incorporates the 3 I mentioned :). So just patching dev with this one should do!
Comment #20
gp.mazzola commented@Torpy
Thank you for your answer. I applied your patch at #17 against the last 7.x-1.x-dev of the module, and it worked nicely.
I have then tested it then and it works fine for me! Documents are passed to the remote SOLR server, extracted and cached properly.
I have not found any bug yet.
Thank you a lot for the patch! :)
I hope it can be committed in the next release!
GP
Comment #21
izus commentedThank you very much for the work done so far, lets try to clean this patch and have this awsome feature in.
I juste looked at the patch for the moment but i'm not reviewing it in details yet, i think it needs some cleanup before a detailed review so that we will focus on this task purpose and forget about related tasks code that are already merged :
1) it would be awsome if we make the patch work for the 7.x-1.x branch as new patches are merged there in preparation of next release in August/September and it would be awsome to have this patch in :)
2) regarding #15, we need to clean this patch deleting the code alreay merged of #1148162: Use real path instead of url to retrieve file and #1895966: Handle (Ignore) Missing Files
but about #1307720: Newly added node files not added properly, my tests didn't help understand the real issue, i just considered the issue was not accurate no more. can you please explain why it is needed for this patch to work or confirm it's not neede anymore with the last code base from 7.x-1.x branch
Thank you again :)
Comment #22
torpy commentedSorry, been very busy recently. I'll get you an updated patch within the next few days, if not today!
Comment #23
torpy commentedUpdated patch against HEAD attached.
Comment #24
torpy commentedIssue status updated.
Also tested point 2 from comment #21 and I can't reproduce it. I've removed that line from this patch.
Comment #25
gp.mazzola commented@torpy
Hi! I have just tried the patch at #24 against latest dev release of the module, but for me it fails to apply
Comment #26
izus commented@gp.mazzola
please try it with 7.x-1.x branch
https://drupal.org/node/1059436/git-instructions/7.x-1.x
Comment #27
gp.mazzola commented@izus
Thank you! Following your suggestion it worked and patched applied nicely agaist 7.x-1.x branch
I've tested then it a little adding some PDF attachment, re-indexing, deleting nodes... and it seems to work fine.
Text inside the attachment is indexed and related cache table in the DB is populated. On the other side deleting the node correctly update SOLR index and remove entry from cache table.
Comment #28
pounardWe're using it since some monthes now, so I guess it's RTBC.
Comment #29
pounardOups forgotten state.
Comment #30
izus commentedassigning to me for final review and merge
Comment #31
hefox commentedThink there's suppose to be a space here (multiple places)
_' . ':' => _:' (multiple places)
Comment #32
torpy commentedUpdated patch attached.
Changes in this patch:
Comment #33
deadbeef commentedUpdated patch so that path of extract request servlet is relative - original doesn't work with multiple cores.
Comment #34
izus commentedHi,
i tested #33 and just merged it to 7.x-1.x
Thanks all for this great patch
you rock