Problem/Motivation
When inline extraction fails, FilesExtractor::queueItem() sets a flag in the search_api_attachments:queued key-value collection and queues the file. FilesExtractor::extractOrGetFromCache() skips inline extraction while that flag is set.
ExtractorQueue::processItem() only clears the flag on success. After the 5th failure it logs and drops the item, but the flag stays:
else {
$message_params['@message'] = $exception->getMessage();
$this->logger->log(LogLevel::ERROR, 'Text extraction failed after 5 attempts @file_id for @entity_type @entity_id: @message.', $message_params);
}So once a file hits 5 failures, inline extraction never runs for it again, even after the extractor is fixed. Happens with any extractor.
Steps to reproduce
- Point the Tika server extractor at a port with nothing listening.
- Index an entity with a file field. Extraction fails and the file gets queued.
- Run cron until the
search_api_attachmentsqueue is empty. The log shows "Text extraction failed after 5 attempts". - Fix the extractor config and reindex the entity.
- The file is indexed without text, and the flag is still in
key_valueundersearch_api_attachments:queued.
Proposed resolution
Clear the flag on the final failure too. The MR moves the existing cleanup into ExtractorQueue::clearQueuedFlag() and calls it from both the success and final-failure paths. Kernel test included.
Remaining tasks
Review the MR.
User interface changes
None
API changes
None
Data model changes
None
Issue fork search_api_attachments-3629175
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
j-barnes commentedComment #5
izus commentedmerged
thanks for this
Comment #7
izus commentedreleased https://www.drupal.org/project/search_api_attachments/releases/10.0.13