#60729: Index taxonomy terms with nodes

4.7.x
Steven Wittens 2006-04-27 22:20:51 +00:00
parent 546f5930a4
commit 954cbf7c65
4 changed files with 34 additions and 2 deletions

View File

@ -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),

View File

@ -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),

View File

@ -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>';
}
}

View File

@ -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>';
}
}