It is important, that the "Error constructing documents to index..." are logged to the watchdog. But why is there a break; to exit the loop?
foreach ($rows as $row) {
try {
$callback($documents, $row->nid, $namespace);
// Variables to track the last item changed.
$position['last_change'] = $row->changed;
$position['last_nid'] = $row->nid;
}
catch (Exception $e) {
// Something bad happened - don't continue.
watchdog('Apache Solr', ' Error constructing documents to index <br /> !message', array('!message' => nl2br(strip_tags($e->getMessage()))), WATCHDOG_ERROR);
break;
}
}
We use Tika to attach PDF-content to the node and sometimes PDF's are corrupt or protected and an exception occurs. Then all other documents in $rows would not be indexed.
Is there a reason, why this break in the loop is necessary?
Thanks,
Thomas
Comments
Comment #1
pwolanin commentedYou need to update perhaps to a newer version of the attachments module? I think any Tika exception should be caught at a lower level.
The idea here is that we don't want to update the last item indexed if that was a fail, but perhaps you are right that it's better to just continue on.
Comment #2
weri commentedYou are right, that Tika exceptions should caught at a deeper level!
As you write, it would be better when the loop continues.
Comment #3
pwolanin commentedComment #4
pwolanin commentedcommitted to 6.x-1.x, shoudl look at other branches too.
Comment #5
robertdouglass commented#878996 by pwolanin | weri: Added Don't break the loop .
Committed to 6.2.
Comment #6
jpmckinney commentedCommitted to 7.x-1.x.