Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.63
diff -u -p -r1.63 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	20 Jul 2009 18:51:34 -0000	1.63
+++ modules/taxonomy/taxonomy.admin.inc	2 Aug 2009 22:03:49 -0000
@@ -747,18 +747,6 @@ function taxonomy_form_term(&$form_state
     $form['advanced']['parent'] = _taxonomy_term_select(t('Parents'), $parent, $vocabulary->vid, t('Parent terms') . '.', 1, '<' . t('root') . '>', $exclude);
     $form['advanced']['relations'] = _taxonomy_term_select(t('Related terms'), array_keys(taxonomy_get_related($edit['tid'])), $vocabulary->vid, NULL, 1, '<' . t('none') . '>', array($edit['tid']));
   }
-  $form['advanced']['synonyms'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Synonyms'),
-    '#default_value' => implode("\n", taxonomy_get_synonyms($edit['tid'])),
-    '#description' => t('One synonym per line. Text input term selection widgets will show terms whose synonyms match the entered value as suggestions.'));
-  $form['advanced']['weight'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Weight'),
-    '#size' => 6,
-    '#default_value' => $edit['weight'],
-    '#description' => t('Terms are displayed in ascending order by weight.'),
-    '#required' => TRUE);
   $form['vid'] = array(
     '#type' => 'value',
     '#value' => $vocabulary->vid);
Index: modules/taxonomy/taxonomy.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v
retrieving revision 1.20
diff -u -p -r1.20 taxonomy.install
--- modules/taxonomy/taxonomy.install	18 Jun 2009 15:46:30 -0000	1.20
+++ modules/taxonomy/taxonomy.install	2 Aug 2009 22:03:50 -0000
@@ -362,3 +362,45 @@ function taxonomy_update_7002() {
   }
   return $ret;
 }
+
+/**
+ * Convert taxonomy term synonyms to a text field.
+ */
+function taxonomy_update_7011() {
+  $ret = array();
+  // Create a 'synonyms' field.
+  $field = array(
+    'field_name' => 'synonyms',
+    'type' => 'text',
+    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
+  );
+  field_create_field($field);
+  // Drupal 6 allows synonyms for all vocabularies whether or not
+  // explicitly set, so ignore the 'synonyms' column in
+  // {taxonomy_vocabulary} and create field instances for each vocabulary.
+  $instance = array(
+    'field_name' => 'synonyms',
+    'label' => 'Synonyms',
+  );
+  foreach (taxonomy_get_vocabularies() as $vocabulary) {
+    $instance['bundle'] = $vocabulary->machine_name;
+    field_create_instance($instance);
+  }
+  */
+  // Fetch all
+  $result = db_query('SELECT tid, name FROM {taxonomy_term_synonym} ORDER BY tsid ASC');
+  foreach ($result as $record) {
+    $synonyms[$record->tid][] = $record->name;
+  }
+
+  // Load all terms which have synonyms, populate the field information,
+  // then save it.
+  $terms = taxonomy_term_load_multiple(array_keys($synonyms));
+  foreach ($terms as $tid => $term) {
+    foreach ($relations[$tid] as $delta => $relation) {
+      $term->related_terms[$delta]['value'] = $relation;
+    }
+    taxonomy_term_save($term);
+  }
+  db_drop_table($ret, 'taxonomy_term_synonym');
+}
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.492
diff -u -p -r1.492 taxonomy.module
--- modules/taxonomy/taxonomy.module	2 Aug 2009 15:44:08 -0000	1.492
+++ modules/taxonomy/taxonomy.module	2 Aug 2009 22:03:51 -0000
@@ -324,6 +324,11 @@ function taxonomy_vocabulary_save($vocab
     }
     field_attach_create_bundle($vocabulary->machine_name);
     module_invoke_all('taxonomy_vocabulary_insert', $vocabulary);
+    $instance = array(
+      'field_name' => 'synonyms',
+      'bundle' => $vocabulary->machine_name,
+    );
+    field_create_instance($instance);
   }
 
   cache_clear_all();
@@ -490,23 +495,6 @@ function taxonomy_term_save($term) {
   }
   $query->execute();
 
-  db_delete('taxonomy_term_synonym')
-    ->condition('tid', $term->tid)
-    ->execute();
-  if (!empty($term->synonyms)) {
-    $query = db_insert('taxonomy_term_synonym')
-      ->fields(array('tid', 'name'));
-    foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
-      if ($synonym) {
-        $query->values(array(
-          'tid' => $term->tid,
-          'name' => rtrim($synonym)
-        ));
-      }
-    }
-    $query->execute();
-  }
-
   cache_clear_all();
   taxonomy_terms_static_reset();
 
@@ -551,9 +539,6 @@ function taxonomy_term_delete($tid) {
           ->condition('tid2', $tid)
         )
         ->execute();
-      db_delete('taxonomy_term_synonym')
-        ->condition('tid', $tid)
-        ->execute();
       db_delete('taxonomy_term_node')
         ->condition('tid', $tid)
         ->execute();
@@ -1132,7 +1117,7 @@ function taxonomy_get_tree($vid, $parent
 function taxonomy_get_synonyms($tid) {
   if ($tid) {
     $synonyms = array();
-    return db_query('SELECT name FROM {taxonomy_term_synonym} WHERE tid = :tid', array(':tid' => $tid))->fetchCol();
+    return db_query('SELECT synonym_value FROM {field_synonym_data_1} WHERE etid = :tid', array(':tid' => $tid))->fetchCol();
   }
   else {
     return array();
@@ -1151,7 +1136,7 @@ function taxonomy_get_synonym_root($syno
   $synonyms = &drupal_static(__FUNCTION__, array());
 
   if (!isset($synonyms[$synonym])) {
-    $synonyms[$synonym] = db_query("SELECT * FROM {taxonomy_term_synonym} s, {taxonomy_term_data} t WHERE t.tid = s.tid AND s.name = :name", array(':name' => $synonym))->fetch();
+    $synonyms[$synonym] = db_query("SELECT * FROM {field_synonym_data_1} s, {taxonomy_term_data} t WHERE t.tid = s.tid AND s.synonym_value = :name", array(':name' => $synonym))->fetch();
   }
   return $synonyms[$synonym];
 }
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.31
diff -u -p -r1.31 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	8 Jul 2009 07:18:08 -0000	1.31
+++ modules/taxonomy/taxonomy.pages.inc	2 Aug 2009 22:03:51 -0000
@@ -99,7 +99,7 @@ function taxonomy_autocomplete($vid = 0,
   if ($tag_last != '') {
     $query = db_select('taxonomy_term_data', 't');
     $query->addTag('term_access');
-    $query->leftJoin('taxonomy_term_synonym', 'ts', 't.tid = ts.tid');
+    $query->leftJoin('field_synonym_value_1', 'ts', 't.tid = ts.etid');
     // Don't select already entered terms.
     if (count($tags_typed)) {
       $query->condition('t.name', $tags_typed, 'NOT IN');
