JCR Tree Model Restructuring in 15.3
Introduction
Goal
After upgrading to 15.3, make large taxonomy trees performant.
Background
In version 15.3, the JCR model backing a taxonomy tree was restructured for performance reasons.
Editing and publishing a large taxonomy, with hundreds of categories plus their locale specific name, description and synonym fields, had become problematic for editors.
JCR Tree Model Change
Before 15.3, the localized information for a category was stored in hippotaxonomy:categoryinfo nodes as follows:
/content/taxonomies/exampletaxonomy/exampletaxonomy: /mycategory: jcr:primaryType: hippotaxonomy:category hippotaxonomy:key: mycategory /hippotaxonmy:categoryinfos: jcr:primaryType: hippotaxonomy:categoryinfos /en: jcr:primaryType: hippotaxonomy:categoryinfo hippotaxonomy:name: My category hippotaxonomy:description: Description of my category hippotaxonomy:synonyms: [Synonym 1, Synonym 2] /nl: jcr:primaryType: hippotaxonomy:categoryinfo hippotaxonomy:name: Mijn categorie hippotaxonomy:description: Beschrijving van mijn categorie
From 15.3 and up, the localized information for a category is stored on the hippotaxonomy:category nodes itself, in prefixed properties, as follows:
/content/taxonomies/exampletaxonomy/exampletaxonomy: /mycategory: jcr:primaryType: hippotaxonomy:category hippotaxonomy:key: mycategory locale.en.name: My category locale.en.description: Description of my category locale.en.synonyms: [Synonym 1, Synonym 2] locale.nl.name: Mijn categorie locale.nl.description: Beschrijving van mijn categorie
Using the latter model is much more performant because less nodes are involved, meaning less database records and less database queries.
Upgrade Considerations
Once a system has been upgraded to 15.3, it is recommended, but not mandatory to use the new model. Not every project has large trees and performance problems.
Both the CMS and the Delivery Tier supports both models. Even a mixed model is possible where some parts of the tree have the locale properties, and some parts have the categoryinfo subnodes.
Taxonomy Editor Upgrades Category Automatically
When editing, or adding, a category in the CMS, it will be converted automatically to the new model. So if there's a small enough tree, it is possible to upgrade to the new model by visiting all categories with all locales in an open taxonomy editor.
The advantage is that a publication action should follow, thereby adding an entry in the revision history.
Groovy Updater Script
Version 15.3 comes with a Groovy script TaxonomyCategoryInfoOptimizer that is added to the Updater Editor. It has some inner documentation and when configured correctly, it will visit all hippotaxonomy:categoryinfo nodes and move the data two levels up.
For very large trees, it is recommended to use this method, although no entry is made in the revision history.
With default settings, the script took around 30 minutes to convert a tree of around 800 categories and 4000 subnodes into the new model.