The following code stops Drupal 6 from indexing a node’s taxonomy as part of its content. The code uses hook_nodeapi to alter the node object when it is being built to update the index. At this stage it is possible to add, remove or alter any of the node’s elements.

This is done in cases where the taxonomy of a node is not relevant to providing good search results. I particularly used this implementation to improve search results in a situation in which nodes had very short descriptions in the body but plenty of taxonomy data, and the presence of the taxonomy terms was diluting the quality of the search results.

The code is inspired on tuning drupal's search index with hook_nodeapi and $node->build_mode

 

function mymodule_nodeapi(&$node,$op) { //if building the node for the search index
  if ($op =='view' && $node->build_mode == NODE_BUILD_SEARCH_INDEX) {
    $node->taxonomy = array();
  }
}

 

You can also add content to the node only at the time of indexing by using something like this instead:

function mymodule_nodeapi(&$node,$op) { //if building the node for the search index
  if ($op =='view' && $node->build_mode == NODE_BUILD_SEARCH_INDEX) {
    $node->content['extra_info'] = array( '#value' => 'This is additional content that will be indexed.', '#weight' => 100, );
  }
}