Expand my Community achievements bar.

SOLVED

AEM TagManager Find() operation

Avatar

Level 3

The find() method from com.day.cq.tagging.TagManager returns content even after the tag has been moved to a new name.

For example:

1. Create a tag "myNamespace:folder/tag"

2. Add this to a page under Geometrixx website

3. Run tagManager.find("/content/", new String[]{"myNamespace:folder/tag"});

4 .You will get 1 result (page tagged in step 2 above)

5. Move this tag to "myNamespace:folder/newTag"

5-B- Verify in CRX, the page shows the new tag now.

6. Again Run tagManager.find("/content/", new String[]{"myNamespace:folder/tag"});

7. This STILL returns the same page from step2 . Even though the tag has been moved and new name id present in CRX also.

Is this a bug in the OOTB functionality or am I missing something?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The tag management implementation is a bit weird. Yeah, renaming might cause this behavior. Can you run the Tag Garbage Collector and check again afterwards?

Building Tagging into an AEM Application

Jörg

View solution in original post

4 Replies

Avatar

Employee Advisor

Internally it is implemented using a JCR query; depending on the index type (property or Lucene index) there might a small lag between a change in the JCR and the time when this change gets reflected in the index. Typically it should not exceed 5 seconds. If your lag is larger, please check your log if you have any messages about indexing issues.

Jörg

Avatar

Level 3

Hi Jorg,

Thanks for your response.

There is no delay or errors in logs. I tried this in a vanilla 6.2 instance as well.

The logs printed :

27.11.2017 16:05:34.680 *INFO* [127.0.0.1 [1511816734671] POST /bin/tagcommand HTTP/1.1] com.day.cq.tagging.impl.JcrTagManagerImpl moving tag from /etc/tags/forum/topic/new-answer to /etc/tags/forum/topic/no-answer

27.11.2017 16:05:34.685 *INFO* [127.0.0.1 [1511816734671] POST /bin/tagcommand HTTP/1.1] com.day.cq.tagging.impl.JcrTagManagerImpl keeping hidden old version of tag at /etc/tags/forum/topic/new-answer

Both old and new tags are preserved by AEM. Old tag "new-answer" got a property 'cq:movedTo' while the new tag "no-answer" got the property 'cq:backlinks'

Are these properties causing this anomaly ?

Avatar

Correct answer by
Employee Advisor

The tag management implementation is a bit weird. Yeah, renaming might cause this behavior. Can you run the Tag Garbage Collector and check again afterwards?

Building Tagging into an AEM Application

Jörg

Avatar

Level 1

Hi Jorg,

I am also facing the same issue on 6.4, But running the Tag Garbage Collector and check again afterwards is not working in my case. I configured the garbage collector to every minute and tried to repeat the steps. Page Jcr:content property cq:tags are not updated as to the moved/updated tag path.

Could you please help on this?

ThanksSathish