Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The taxonomy mapper doesn't check for repeat terms before adding them to the node. The node field must allow unlimited cardinality to see this minor bug. The result can be the same term appearing multiple times on the node.
Adding array_unique before parsing out the terms fixed the problem for me.
Patch attached, sorry for the p4 format.
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds-duplicate_taxonomy-2172865-2.patch | 1.99 KB | nadavoid |
taxonomy-unique-1.patch | 540 bytes | kscheirer | |
Comments
Comment #2
nadavoid CreditAttribution: nadavoid commentedThis happens on text fields too, and possibly others. Attaching a patch that addresses this for both termreference and text fields.
Comment #3
nadavoid CreditAttribution: nadavoid commentedComment #5
twistor CreditAttribution: twistor commentedThis is per-design. If it's in the feed, it's in the field. There could be an argument for doing this for term reference fields, but definitely not text fields. You can use something like Feeds Tamper to filter the list before it gets into the mapper.
Comment #6
nadavoid CreditAttribution: nadavoid commented@twistor, could you reconsider this? The issue is not that multiple duplicate values that are present in the source feed get imported. Let me describe the issue a little better...
Say you have a content type with a title, a unique ID field (for updates) and a multi value text field called Cities. Have a csv file with title in one column and cities in another column, pipe delimited. Using feeds tamper, you split out those cities. When you import the first time, everything looks right. You have one of each value that was in the source csv. You have the importer set to update content when reimporting. So I update the title in the csv and reimport. The title is updated, but now I have two of each city that is in my source feed, even though I didn't change or add any. If you update the title 5 times this way, you'll have 5 duplicates of every city. That's what the attached patch addresses.
Comment #7
twistor CreditAttribution: twistor commentedCan you try the recent dev release? This should already be fixed.
Comment #8
nadavoid CreditAttribution: nadavoid commented@twistor I just just tested the latest dev release and this issue does seem to be fixed there. Thanks!