Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

AEM Tags Behaviour

Avatar

Level 1

NameSpace 1: tag A    .............if Moved to Namespace 2 It will create cq:movedTo: NameSpace2

NameSpace 2: TagA.............. will create cq: backlink of Namespace1

SO, the reference of Tag on resources is not updated?

Don't know the behavior of Tags moving from one Namespace to another?

1 Accepted Solution

Avatar

Correct answer by
Level 10

After checking with internal AEM ppl - they replied:

Yes, this is expected.

When you move/rename a tag its only create cq:movedTo and Tag Manager use it to present a proper tag name.

AEM cannot rename all applied rag as it will literally kill AEM performance

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

After checking with internal AEM ppl - they replied:

Yes, this is expected.

When you move/rename a tag its only create cq:movedTo and Tag Manager use it to present a proper tag name.

AEM cannot rename all applied rag as it will literally kill AEM performance

Avatar

Level 4

When we move a namespace, here's what happens:

1. The namespace gets created at the new location, along with all the tags under that namespace.

2. The old namespace gets a cq:movedTo property that points to the new namespace. Similarly, all the tags under the old namespace get a cq:movedTo property pointing to new tag locations.

3. The new namespace get a cq:backlinks property pointing to the old namespace and similarly all tags under the new namespace get a cq:backlinks property as well.

The old namespace is hidden and is only kept in the repository to resolve tag IDs in content nodes pointing to it. The tag garbage collector removes old tags once no more content nodes point to them.

Now, the significance is, lets say we search for content by tag ids, and we want to search by the new tagid created, then Tag API​ makes sure that all pages tagged with the new tag and the old tag from where it is moved would be returned. See getXPathSearchExpression(String property) and getGQLSearchExpression(String property) methods.

Also, in the search debugger, when I try to search for the new tag, here is the corresponding XPath query generated:

BrandC namespace was moved to BrandD

When I search for content tagged with a tag under namespace BrandD,

Screen Shot 2018-03-23 at 10.17.26 AM.png

Here is the corresponding XPath query generated:

Screen Shot 2018-03-23 at 10.16.30 AM.png

Also, another interesting point to note is, Lets say I am moving Namespace A to NamespaceB and there is no content tagged with NamespaceA or the tags under it, then Namespace A would just be deleted and NamespaceB would be created. There is no cq:movedTo or cq:backlinks property set in this case.

Hope this helps!