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

CommentFileSizeAuthor
#3 878996-remove-break-3.patch1.14 KBpwolanin

Comments

pwolanin’s picture

Version: 6.x-1.1 » 6.x-1.x-dev

You 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.

weri’s picture

You are right, that Tika exceptions should caught at a deeper level!

As you write, it would be better when the loop continues.

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new1.14 KB
pwolanin’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

committed to 6.x-1.x, shoudl look at other branches too.

robertdouglass’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

#878996 by pwolanin | weri: Added Don't break the loop .
Committed to 6.2.

jpmckinney’s picture

Status: Patch (to be ported) » Fixed

Committed to 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.