I am using option "Allow and insert new terms by the user into the vocabulary" in Freetagging setting
I have a vocabulary "Tags" from where i set a term as parent for these new terms, we review these tags and then merge them into main vocabulary.

When i update a node, if there is a term in any other vocabulary having same name as in the "Tags" vocab, duplicate terms are getting created.
They are visible only in the node view, when i try to edit the node - the fields have expected values.

I searched the issue que, found some thing similar is caused by TAC, but i am not using this module.

Comments

asb’s picture

Priority: Normal » Critical

I'm experiencing the same issue on one site with 6.x-1.0-rc2: Taxonomy terms are being aliased over and over again; it seems that every time a taxonomy term is used to categorize content, a new term is created instead of "using" the old one. That's how my 'url_alias' table looks like:

mysql> select pid,src,dst from url_alias where src like '%taxonomy%' and dst like '%myterm%';
+-------+--------------------+-----------------------------------------------------------------+
| pid   | src                | dst                                                             |
+-------+--------------------+-----------------------------------------------------------------+
| 22228 | taxonomy/term/1516 | category/project/myterm-2                                     |
| 22227 | taxonomy/term/1515 | category/project/myterm-1                                     |
| 22225 | taxonomy/term/1513 | category/project/myterm-0                                     |
| 22320 | taxonomy/term/1610 | category/project/myterm-9                                     |
| 22761 | taxonomy/term/2055 | category/project/myterm-10                                    |
| 22764 | taxonomy/term/2058 | category/project/myterm-11                                    |
| 22765 | taxonomy/term/2059 | category/project/myterm-12                                    |
| 22766 | taxonomy/term/2060 | category/project/myterm-13                                    |
| 22768 | taxonomy/term/2062 | category/project/myterm-14                                    |
| 22770 | taxonomy/term/2064 | category/project/myterm-15                                    |
...

I have no procedure to reproduce this on another site. Potentially also involved: 'pathauto', 'globalredirect', 'path_redirect', 'Internationalization' (i18n). I'm using 'content taxonomy' with a freetagging vocabulary, allow insertion of new terms and save additionally to term_node.

'i18nstrings', and 'i18ntaxonomy' are not enabled or even installed on the affected site, but they were installed some time ago (but were properly uninstalled through the module's "unisntall" feature).

I'm setting this issue to "critical" since a) it is known is various incarnations for several years and obviously never has been properly fixed, and b) it breaks a core functionality (taxonomy).

Related issues:

BigTimeSam’s picture

Hi,

I had the same issue and I resolved it by adding a check to content_taxonomy_autocomplete_insert_tags(...) function to use a previous term if it exists. Here's the function with my modifications:

/**
* Insert new tags
*
* @param $nid the node id
* @param $terms an array of all nonexisting terms.
* @return an array of newly inserted term ids
*/
function content_taxonomy_autocomplete_insert_tags($terms, $parent = NULL) {
if ($parent) {
$parent_term = taxonomy_get_term($parent);
$vid = $parent_term->vid;
}
foreach ($terms as $term) {
$edit = array('vid' => $term['vid'], 'name' => $term['name']);
if ($parent) {
$edit['parent'] = $parent;
$edit['vid'] = $vid;
}

$add = true;

$existing_terms = taxonomy_get_term_by_name($term['name']);
foreach( $existing_terms as $existing_term ) {
if( $existing_term->name == $term['name'] && $existing_term->vid == $term['vid'] ) {
$add = false;
continue;
}
}

if( $add ) {
$status = taxonomy_save_term($edit);
$saved_terms[$edit['tid']] = $edit['tid'];
}
}
return $saved_terms;
}

asb’s picture

@BigTimeSam: Could you please roll a patch with your modifications? Obviously the maintainers ignore issues marked as "critical" otherwise... Thanks!

And, btw, has anyone found a solution to fix the damaged vocabularies (thousends of duplicates)? Even if the issue would be fixed, it'd be close to impossible to "fix" this manually...

shahinam’s picture

I have fixed the vocabularies by:
1. Deleting all the related entries from term_node table
2. Then recreating the entries using the entries in the cck content type tables i.e content_type_
3. Then check for all terms that do not have any associated node, and delete them.
4. If you still have duplicate terms, you can merge them manually. Though that is little painful, but is worth doing.

asb’s picture

@shahinam: Thanks for the workaround approach. At least in my use case, merging terms severely conflicts with another issue (#665868: Content Taxonomy Field Values Lost after Using Taxonomy Manager Term Merge Operation), which causes even more damage when trying to repair the broken stuff. Considering that the fix from #2 has never been committed I have my doubts if it's a good idea to deploy 'Content Taxonomy' with multiple patches into production.

Since the 6.x branch of this module appears to be de-facto abandoned, it might be worth to evaluate approaches to get rid of this broken module and quickly work towards a clean migration to D7 :-(

asb’s picture

This critical issue is open for well over one year, without getting any response from a maintainer - if there is still one. Question: Is this module still maintained, as the project page suggests, or should it be marked as "abandoned"?

Regarding the changes suggested in #2, I assume the go into content_taxonomy_autocomplete.module; as far as I can tell, the additional checks have no effect, at least none I would notice in my use case :-(