Fuzzy Term Merge
This module helps administrators find and merge duplicate or near-duplicate taxonomy terms using fuzzy string matching. It identifies potential matches and provides a guided wizard to review and merge them, preventing fragmented content and improving search accuracy.
Finds and cleans up near-duplicate taxonomy terms. Fuzzy string matching surfaces likely duplicates within a vocabulary; a short wizard walks you through reviewing and merging them.
Why
Vocabularies accumulate duplicates over time — "Aluminium" vs "Aluminum", "T-Shirt" vs "Tshirt". They fragment content, break faceted search, and skew reporting. Merging them by hand is slow and error-prone.
What it does
Path-aware matching
Every pair is scored on two axes and blended into one match score:
- Leaf % — name similarity (
similar_text()/levenshtein()). - Path % — how much of the two terms' taxonomy ancestry overlaps.
Comparison spans the whole vocabulary, so the same name in two different branches (e.g. "Apple" under Fruit vs Company) is surfaced but flagged with a low path score — the signal that tells a homonym apart from a true duplicate. Each term shows its hierarchy breadcrumb, and the score expands to reveal the leaf/path breakdown.
Safe hierarchy handling on merge
- Children of a merged-away term are re-parented onto the surviving term — no orphaned subtrees.
- Optionally, parent terms left empty by the merges (no children, no content references) can be pruned too — opt-in, with a preview of exactly what will be removed.
The rest
- Three-step wizard: analyse → choose direction per pair → confirm & execute.
- Configurable similarity threshold and minimum term length; AJAX results, no page reload.
- Usage counts across all entity-reference fields (nodes, products, paragraphs, media, etc.) to help pick the term to keep.
- Batch processing for vocabularies of any size.
- Multilingual, with fallback to the default translation.
- Drush command (
ftm-tfd) for command-line audits. - Session-scoped state via
PrivateTempStore; no custom schema, no custom permissions.
Requirements
- Drupal 10 or 11, PHP 8.1+
- Term Merge 2.x — performs the merge and defines the
merge taxonomy termspermission - Drush (optional) — only for the
ftm-tfdcommand
Install
Require via Composer, enable alongside Term Merge, and grant merge taxonomy terms to the relevant roles. A Fuzzy merge tab appears on each vocabulary's admin page.
Limitations
- Merges are permanent — no undo. Back up before running on production.
levenshtein()is limited to 255-byte strings (shown as "n/a" beyond that).