The main purpose of this page is to provide help and explanations on how to use Term Merge module. This module allows you to merge one or more taxonomy terms into another, thus reducing amount of redundant synonymous terms in taxonomy vocabularies.
Quick Intro
At some point you may come up with a wish to eliminate a term from your taxonomy vocabulary, however, simply removing such a term may break many relations within your website, such as those created via term reference fields or entity reference fields. Merging a term into another allows to update all links pointing to the first term to be updated to point to the second term before the first one gets deleted. This way relations inside your database stay valid. Here is an example:
Let's say you have a website of car listings and among other parameters you have a field that denotes color of each car. Colors are structured in a taxonomy vocabulary. So in your car node you will have a term reference field that points to color vocabulary. As time goes by... content gets created, and all of a sudden you realize you have two colors "blue" and "dark blue", but for whatever reason you believe there cannot be any difference between them. You were going to delete the "dark blue" color, but you noticed that there are zillions of cars that have this color. You can no longer delete that term because if you do, you'll have lots of cars that do not have any color. This is where Term Merge comes in! This module will update all cars that has "dark blue" color and will make them "blue" colored, and only after will delete the "dark blue" term.
Currently you can merge terms from 2 different prospectives:
- manually picking up terms to be merged (branch terms);
- using duplicate-term merge tool shipped with Term Merge module.
Let us cover each section in greater details. But before we dive in, let's follow this terminology: we will call term branch(-es) all the terms that are going to be merged in some term, whereas the term, into which others are merged, is called trunk term. Think of CVS and "merge branch" conceptions to understand why this terminology was implemented.
Manually merging terms
When merging terms manually, you will choose the terms you want to merge and will choose a term to merge into. Go to path admin/structure/taxonomy/[your-vocabulary]/merge to start manual merging. On this page you will enter necessary information before firing it up.
Not difficult to guess, you will be asked to select terms to merge (branch terms) and term to merge into (trunk term). Besides this most basic configuration for your convenience additional merge settings were provided:
Only merge occurrences
Tick this checkbox if you want only to update links from branch terms to trunk term, but you do not want to delete the branch terms, i.e. all your "dark blue" cars will become "blue", but you will still have "dark blue" term in your vocabulary.
Note: One additional place, where terms can be heavily used is Views, specifically Views Taxonomy filter. Imagine you created a view to filter on all cars that have "dark blue" color (you wanted to see how many of those are out there before deciding what to do) and you haven't deleted that view. If you merge "dark blue" into "blue" without "only merge occurrences" setting "dark blue" term will be deleted, and your view will render useless: it will be filtering on a term that does not even exist! Out of logic that trunk term becomes a successor of all the branch terms and if the latters are deleted, Views Taxonomy filters, filtering on any of the branch terms will be updated to filter on the trunk term. This way, after merging without "merge only occurrences" your view will now be filtering on "blue" color, which appears to be better than filtering on a non-existent "dark blue".
Merge Term Fields
If terms in the vocabulary, inside of which you are about to merge, have fields attached to them, you may want to collect values of those fields from branch terms and put them into the corresponding values of trunk term. Otherwise those values will be lost.
Note: if your terms do not have fields attached to them, you will not see this setting.
Another node: values to the corresponding fields of trunk term will be added until cardinality limit is reached for that field. Thus it makes most sense to use this setting on the fields that have unlimited cardinality.
Keep only unique terms after merging
If your node (or any other entity) had both branch term and trunk term referenced in its term reference field, you will end up having referenced the same trunk term twice after merging. To prevent this from happening simply tick this checkbox. Back to our example: let's say there was a car with 2 colors: blue and dark blue, after merging it would be of 2 colors: blue and blue (duh...). However, if you tick this setting on, the car will have only one color: blue.
Create Redirect
After deletion of branch terms what happens to the pages of branch terms?.. yes, they become "Page not found" error, and what if one of those pages was in top of google search results? You're screwed, but we've thought for you! If you have enabled Redirect module it will allow you to create SEO-friendly redirects from all branch terms pages to the trunk term page. So your visitors will not get "Page not found" error.
Add as Synonyms
Term Merge module also integrates with Synonyms module. If you want branch terms to become synonyms of the trunk term, simply pick the fields into which you want to add branch terms as synonyms into the trunk term. (Read more about Synonyms and source of synonyms fields on Synonyms module homepage). Back to our example: as we agreed you believe "blue" and "dark blue" are the same thing. Yesterday you merged one into another, but today you woke up and discovered that someone on your website again created "dark blue" term and already created a car with that color. You can't be merging terms every other day. Instead, when merging "dark blue" into "blue" add it as a synonym to "blue" term, next time when people will try to create term "dark blue" they'll be suggested to use "blue" and hopefully you never again will have to merge these 2 terms.
Step
Each website's database is different, so are available server resources. Depending on circumstances merging terms could become resource intensive and time consuming task. Even worse, at some point in the merge batch you might get memory limit PHP errors or max execution time errors. This setting allows you to specify how many terms you want to merge during one script run in batch. Rule of thumb: the default is reasonable for the majority of situations, however, if you are experiencing PHP memory limit or max time exection errors while merging, lower this parameter.
After specifying all settings and branch/trunk terms on that form you will be taken to a next page, where you are requested to confirm the merge you are about to start: we do not want you accidently to screw your database up by an unwanted term merge. After confirmation you will see a batch process of actual term merging.
Duplicate-term merge tool
To help you fighting against synonymous terms in your vocabularies Term Merge module also ships with a tool that tries to find synonymous terms in your vocabulary and suggests to merge them together. Its logic is quite basic, but it is better than nothing: it simply studies name of the terms trying to group them into those with similar/identical names, later suggesting to merge such groups into a single term. To take advantage of this tool go to path admin/structure/taxonomy/[your-vocabulary]/merge/duplicates
On that page you will see a number of tables (groups suggested for merging), each of such table will contain at least 2 terms. We tried to provide sufficient amount of description about each of the duplicate-terms. You are expected to study those tables and tick checkboxes of the terms that you want to merge (branch terms). Additionally you are required to select trunk term - tick the radiobutton "Merge Into" of the term you want to merge into (trunk term).
Down below the tables you will find already familiar to you set of merge settings. Please, refer above in ths page for detailed description of each merge setting.
After submitting the form you will requested to confirm the action you are about start. Once confirmed, actual term merging will start in a batch process.