As you just learned, the Tridion keyword hierarchy is "fake." Keywords are stored as a flat list, and not as a hierarchical list (for example, you have folders). The parent and children keyword information is stored in the keyword itself.
There are solutions for this - of course, for example, you can use this in C # TBB:
Keyword keyword = new Keyword(new TcmUri("tcm:28-3368-1024"), session); string hierarchy = keyword.Title; bool done = false; while(!done) { if (keyword.ParentKeywords.Count > 0) { foreach (Keyword k in keyword.ParentKeywords) { hierarchy = k.Title + " > " + hierarchy; } keyword = keyword.ParentKeywords[0]; } else done = true; }
EDIT: Updated to recursively "raise" the hierarchy. HOWEVER, several parents can have a keyword, I will leave it to you to fix it ...
source share