function search_nodeapi in Drupal 6
Implementation of hook_nodeapi().
File
- modules/
search/ search.module, line 630 - Enables site-wide keyword searching.
Code
function search_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
// Transplant links to a node into the target node.
case 'update index':
$result = db_query("SELECT caption FROM {search_node_links} WHERE nid = %d", $node->nid);
$output = array();
while ($link = db_fetch_object($result)) {
$output[] = $link->caption;
}
if (count($output)) {
return '<a>(' . implode(', ', $output) . ')</a>';
}
break;
// Reindex the node when it is updated. The node is automatically indexed
// when it is added, simply by being added to the node table.
case 'update':
search_touch_node($node->nid);
break;
}
}