Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to reduce load on our server, much of which is from Tika indexing PDFs. We have a situation whereby nodes are often edited and resaved without the file content changing, but Tika then goes ahead and reindexes all the PDFs.
Is there an existing way to tell search_api_attachments not to reindex such attachments?
If not existing already, I'm happy to code this myself. Is there any reason this wouldn't be possible?
Thanks,
Shiraz
Comment | File | Size | Author |
---|---|---|---|
#4 | search_api_attachments-preserve_cache-2307225-4.patch | 1.87 KB | Grimreaper |
#3 | search_api_attachments-preserve_cache-2307225.patch | 1.46 KB | Shiraz Dindar |
Comments
Comment #1
izus CreditAttribution: izus commentedHi,
there is the cache_search_api_attachments cache table.
The method getFileContent already does this work
The cache is updated during hook_file_update hookfile_delete and when clearing the cache (take a look at .module)
Doesn't this work for you or maybe somehow in your case, some code forces cache rebuild during the node update ?
Comment #2
Shiraz Dindarthanks izus.
the problem is the cache tables get cleared too frequently in our setup. i wonder if it's kosher to skip the search_api_attachments_flush_caches and only flush manually (drush cmd, button on a settings page, etc). if you're open to that, let me know and i'll provide a patch. could make it an option.
Comment #3
Shiraz DindarSo this is the start, and it does work for us.
I'd also add a button on the settings form to clear the cache table manually.
Comment #4
GrimreaperHello,
I have reviewed your patch.
I added default value to your variable_get to preserve configuration on existing websites.
I don't know how to have a simple way to see significant improvement in the speed to test.
Thanks for your patch.
Comment #5
GrimreaperComment #7
izus CreditAttribution: izus commentedhi,
Thank you guys, this is merged now :)
Comment #10
Shiraz Dindarthank you!