Quantcast
Channel: drupal.org - Site administrators
Viewing all articles
Browse latest Browse all 426

Mass Taxonomy Merge

$
0
0

This module is still a Work In Progress! The functionality is rather limited at the moment. I strongly suggest looking at: Taxonomy Manager or Term Merge modules in the mean time.

Overview

Mass Taxonomy Merge is made to be a tool for doing a one-time mass update of taxonomy in a system with large amounts of content. Other modules that exist, while very effective, take considerable amounts of time to run in systems with large amounts of content. Mass Taxonomy Merge allows the user to upload a simple CSV file with a list of terms to merge from and merge in to. Mass Taxonomy Merge module operates on the database itself instead of loading all entities - meaning it is more likely to mess up custom code. Feel free to file feature requests to make it work with other modules.

What it does do

  • Create terms
  • Merge existing terms
  • Delete terms
  • Handles child terms (either merging them into the new terms, or deleting if term was deleted)

What it does not (yet) do

  • Does not call any hooks, so you can't hook in to it.
  • Cannot control the url alias changes if you choose to use it.
  • Cannot use terms being created or renamed as parents in later changes.

How to use Mass Taxonomy Merge

1. Create a CSV file (like the table listed below).

2. Navigate to admin/structure/mass_taxonomy_merge

  • Choose whether or not it should update url aliases for merged terms This forces the new pattern to be $vocabulary_name/$term_name TODO: Add field to allow user to set the pattern.
  • Select the CSV file to upload

3. Upon submit, the terms will be merged. This can take many minutes

4. Navigate to admin/config/development/performance

  • Clear all caches! Caches must be cleared since the database tables were altered without changing the cache.

Complete!

Example CSV:

IndexFrom TermTo TermVocabularyParents
1mistaekmistakethingscar
2mistake 2mistake_2thingscity
3mistake2mistake_2thingscity
4testtest
5foodtagsactivities
6artarttags
7rderedcolors

The outcome of each row is:

1) Create new term 'mistake', merge all existing data for 'mistaek' in, delete term 'mistaek'
2) Create new term 'mistake_2', merge all existing data for 'mistake 2' into the new term, and delete 'mistake 2' term.
3) Merge all existing data for 'mistake2' into the recently created 'mistake 2' term.
4) Deletes the term 'test'
5) Creates the term 'food'
6) Finds all versions of the term 'art' (within the vocabulary 'tags'), merges them together, deletes extra terms.
7) Find all instances of rde (within the vocabulary 'colors'), merge them together with existing 'red' tag delete extras.

Example Taxonomy Before & After using above CSV

Pattern is:
parent_term
-->child_of_parent_term
---->child_of_child_of_parent_term
new_parent_term

Before

Vocabulary: Things

car
-->mistaek
-->sedan
-->truck
-->mistake2
---->mistake_child
city
-->NYC
-->LA
-->mistake 2
---->another_child

Vocabulary: Test

new
-->term
---->test
------>test2
drupal
-->rocks
-->mistaek

Vocabulary: Tags

activities
-->art
---->photography
-->sports
-->web development
-->art
---->painting
-->cooking
-->art
---->drawing
---->painting

Vocabulary: Colors

rde
-->crimson
blue
-->navy
-->royal
red
-->burgundy
purple
-->magenta
-->violet
rde
-->ruby

After

Vocabulary: Things

(renamed 'mistaek', merged old 'mistake 2' and 'mistake2' into new 'mistake_2', kept children, lost their parents)
car
-->mistake
-->sedan
-->truck

city
-->NYC
-->LA
--> mistake_2
---->mistake_child
---->another_child

Vocabulary: Test

(deleted term 'test', subsequently deleted child term 'test2', 'mistaek' not renamed since it is not the correct vocabulary)
new
-->term

drupal
-->rocks
-->mistaek

Vocabulary: Tags

(created new term 'food', combined all 'art' terms into one and moved their children)
activities
-->art
---->photography
---->drawing
---->painting
---->painting
-->sports
-->web development
-->cooking
-->food

Vocabulary: Colors

(multiple copies of 'rde' and 'red' merged into one, all children brought along as well)
blue
-->navy
-->royal
red
-->burgundy
-->ruby
-->crimson
purple
-->magenta
-->violet


Viewing all articles
Browse latest Browse all 426

Trending Articles