| 1 |
<?php |
<?php |
| 2 |
// $Id: apachesolr.module,v 1.1.2.12.2.155.2.36 2009/11/20 11:11:03 robertDouglass Exp $ |
// $Id: apachesolr.module,v 1.1.2.12.2.155.2.37 2009/11/20 11:37:36 robertDouglass Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 349 |
$callbacks = array_filter($callbacks, 'function_exists'); |
$callbacks = array_filter($callbacks, 'function_exists'); |
| 350 |
|
|
| 351 |
foreach ($rows as $row) { |
foreach ($rows as $row) { |
| 352 |
// Variables to track the last item changed. |
try { |
| 353 |
$position['last_change'] = $row->changed; |
// Build node. Set reset = TRUE to avoid static caching of all nodes that get indexed. |
| 354 |
$position['last_nid'] = $row->nid; |
if ($node = node_load($row->nid, NULL, TRUE)) { |
| 355 |
// Build node. Set reset = TRUE to avoid static caching of all nodes that get indexed. |
foreach ($callbacks as $callback) { |
| 356 |
if ($node = node_load($row->nid, NULL, TRUE)) { |
// The callback can either return a $document or an array of $documents. |
| 357 |
foreach ($callbacks as $callback) { |
$documents[] = $callback($node, $namespace); |
| 358 |
// The callback can either return a $document or an array of $documents. |
} |
|
$documents[] = $callback($node, $namespace); |
|
| 359 |
} |
} |
| 360 |
|
// Variables to track the last item changed. |
| 361 |
|
$position['last_change'] = $row->changed; |
| 362 |
|
$position['last_nid'] = $row->nid; |
| 363 |
|
} |
| 364 |
|
catch (Exception $e) { |
| 365 |
|
// Something bad happened - don't continue. |
| 366 |
|
watchdog('Apache Solr', 'Error constructing documents to index: <br /> !message', array('!message' => nl2br(strip_tags($e->getMessage()))), WATCHDOG_ERROR); |
| 367 |
|
break; |
| 368 |
} |
} |
| 369 |
} |
} |
| 370 |
|
|