When importing terms with "create_term" enabled, case-variations on existing terms result in both the existing term (with the wrong case) and a new term (with the correct, updated case) being added to the taxonomy term reference field.
In my migration, I have:
$this->addFieldMapping('field_term_topic', 'topic')
->description(t('Topic'))
->arguments(array('create_term' => TRUE));
I have an existing taxonomy term named "Social conditions", but the migration data now has the term "Social Conditions".
Both terms get included in the migrated field because the database query that gathers existing terms is case-insensitive; a new term is created if there is no exact case-sensitive match found, but all matches are ultimately added to the field. In my case, the field will contain both "Social conditions" and "Social Conditions", even though only the latter is specified in the data.
I'll post a patch shortly.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1378114-1-migrate-taxonomy_case_sensitivity.patch | 2.23 KB | becw |
Comments
Comment #1
becw commentedI don't think this issue is related to #1308268: Terms get duplicated with MigrateDestinationTerm, which is about exact, case-sensitive duplication of terms.
Comment #2
becw commentedHere's a patch.
Comment #3
mikeryanI don't think Migrate should presume to fold terms of different cases together - if the source data for a migration has "Drupalcon" and "DrupalCon" terms, the default behavior should be to replicate that. If there is to be a case-folding feature, it should be enabled by an argument.
Comment #4
becw commentedThis patch doesn't do case folding--it makes sure that the case of the term added to the node exactly matches the case of the data.
Comment #5
becw commentedComment #6
mikeryanCommitted, thanks!
Comment #7.0
(not verified) commentedClarified what happens in my example.