--- taxonomySearch.module	2007-11-13 17:31:33.000000000 -0600
+++ taxonomySearch.module.patched	2008-02-07 13:26:55.000000000 -0600
@@ -98,14 +98,19 @@ function taxonomySearch_widget($op, &$no
 
       
       $options_term = array();
-      foreach (taxonomy_get_tree($field['widget']['ts_vid']) as $term) {
-        $options_term[$term->tid] = $term->name;
-      }
-
+      $potential = array_keys(_nodereference_potential_references($field));
+      if (!empty($potential)) {
+      	$result = db_query('SELECT DISTINCT tid FROM {term_node} tn WHERE tn.nid IN ('.implode(',',$potential).')');
+ 				$tids = array();
+      	while ($row = db_fetch_object($result)) $tids[] = $row->tid;
+				foreach (taxonomy_get_tree($field['widget']['ts_vid']) as $term) {
+					if (in_array($term->tid,$tids)) $options_term[$term->tid] = $term->name;
+				}
+			}
       
       $form[$fieldname]['ts_tids'] = array(
         '#type' => 'select',
-        '#title' => t($field['widget']['label'])."  Selector ",
+        '#title' => t('@label Selector',array('@label' => $field['widget']['label'])), 
         '#default_value' => $items['default tids'],
         '#multiple' => $field['multiple'],
         '#options' => $options_term,
@@ -128,7 +133,7 @@ function taxonomySearch_widget($op, &$no
 
       $form[$fieldname]['nids'] = array(
         '#type' => 'select',
-        '#title' => t($field['widget']['label']),
+        '#title' => t('@label filtered list',array('@label' => $field['widget']['label'])), 
         '#default_value' => $items['default nids'],
         '#multiple' => $field['multiple'],
         '#options' => $options,
@@ -202,7 +207,7 @@ function taxonomySearch_autocomplete($fi
     
     $tags=taxonomy_node_get_terms($row->nid);
     if (isset($tags[$string])) {
-            $matches[$row->nid] = _nodereference_item($field, $row, TRUE);
+            $matches[$row->nid] = strip_tags(_nodereference_item($field, $row, TRUE));
 //            $matches[$row->node_title .' [nid:'. $row->nid .']'] = _nodereference_item($field, $row, TRUE);
     }
   }
