function tripal_feature_index_feature
1.x indexFeatures.inc | tripal_feature_index_feature($feature_id, $nid) |
Related topics
1 call to tripal_feature_index_feature()
- indexFeatures.inc in tripal_feature/
includes/ indexFeatures.inc - @todo Add file header description
File
- tripal_feature/
includes/ indexFeatures.inc, line 137 - @todo Add file header description
Code
function tripal_feature_index_feature($feature_id, $nid) {
#print "\tfeature $feature_id nid $nid\n";
// return if we haven't been provided with a feature_id
if (!$feature_id) {
return 0;
}
// if we only have a feature_id then let's find a corresponding
// node. If we can't find a node then return.
if (!$nid) {
$nsql = "SELECT N.nid,N.title FROM {chado_feature} CF " .
" INNER JOIN {node} N ON N.nid = CF.nid " .
"WHERE CF.feature_id = %d";
$node = db_fetch_object(db_query($nsql, $feature_id));
if (!$node) {
return 0;
}
$node = node_load($node->nid);
}
else {
$node = node_load($nid);
}
// node load the noad, the comments and the taxonomy and
// index
$node->build_mode = NODE_BUILD_SEARCH_INDEX;
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
node_invoke_nodeapi($node, 'view', FALSE, FALSE);
// $node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');
// $node->body .= module_invoke('taxonomy','nodeapi', $node, 'update index');
// print "$node->title: $node->body\n";
search_index($node->nid, 'node', $node->body);
# $mem = memory_get_usage(TRUE);
# $mb = $mem/1048576;
# print "$mb mb\n";
return 1;
}