Commit 954cbf7c authored by Steven Wittens's avatar Steven Wittens

#60729: Index taxonomy terms with nodes

parent 546f5930
......@@ -716,6 +716,8 @@ function node_search($op = 'search', $keys = null) {
// Fetch comments for snippet
$node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');
// Fetch terms for snippet
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
$extra = node_invoke_nodeapi($node, 'search result');
$results[] = array('link' => url('node/'. $item->sid),
......
......@@ -716,6 +716,8 @@ function node_search($op = 'search', $keys = null) {
// Fetch comments for snippet
$node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');
// Fetch terms for snippet
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
$extra = node_invoke_nodeapi($node, 'search result');
$results[] = array('link' => url('node/'. $item->sid),
......
......@@ -1182,7 +1182,21 @@ function taxonomy_nodeapi($node, $op, $arg = 0) {
break;
case 'rss item':
return taxonomy_rss_item($node);
break;
case 'update index':
return taxonomy_node_update_index($node);
}
}
/**
* Implementation of hook_nodeapi('update_index').
*/
function taxonomy_node_update_index(&$node) {
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = $term->name;
}
if (count($output)) {
return '<strong>('. implode(', ', $output) .')</strong>';
}
}
......
......@@ -1182,7 +1182,21 @@ function taxonomy_nodeapi($node, $op, $arg = 0) {
break;
case 'rss item':
return taxonomy_rss_item($node);
break;
case 'update index':
return taxonomy_node_update_index($node);
}
}
/**
* Implementation of hook_nodeapi('update_index').
*/
function taxonomy_node_update_index(&$node) {
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = $term->name;
}
if (count($output)) {
return '<strong>('. implode(', ', $output) .')</strong>';
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment