AEM Tagging - Not pulling results with TagManager.find | Community
Skip to main content
b7wilso
Level 3
March 7, 2016

AEM Tagging - Not pulling results with TagManager.find

  • March 7, 2016
  • 1 reply
  • 6685 views

Sorry, I really hope that this is not too basic of a question.  That said, please forgive the basic-ness of the question as this is really my first foray into tagging.  My local environment is a Windows environment running AEM 6.1, but I don't think I have gotten around to installing SP1 there yet.  Alternatively, my Dev environment is on Linux, AEM 6.1 and we do have SP1 installed on there.

So I have a component built on tagging that works just fine in my local environment (both Author and Publisher) but when I promoted it to our Dev environment it is not pulling the results with TagManager.find in Publisher only (but it does work in Author).  When I first tested on Publish in my local environment it didn't work there either at first, until I found https://docs.adobe.com/docs/en/aem/6-1/develop/tags/framework.html and added cq:Taggable to the Page Component, at which point it worked fine.  Based on the displays I have setup in the code, TagManager.find is returning null (and not throwing any sort of error).  I am doing a ResourceResolver.adaptTo to create the TagManager.  Please see attached screen shots.

Thanks in advance for your help!

Brad W

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

edubey
Level 10
March 8, 2016

Have you replicated tags which are created in Dev author to Dev publish?

b7wilso
b7wilsoAuthor
Level 3
March 8, 2016

Good thought, but it auto-promoted just that tag when I promoted either page or the tagged component.

b7wilso
b7wilsoAuthor
Level 3
March 9, 2016

Can you provide the code snippet for the getOptionalTags() method, I think that's the method of interest here since that is where the tags are retrieved and built.


Naveen - I am including it below, but after what I came across yesterday afternoon, I don't believe that this is the problem (not to mention, this is returning the one tag that is in the field).

public Optional<String[]> getOptionsTags() { return get("cq:tags", String[].class); }

All of that said, I think the key thing at this point seems to be the cq:Taggable declaration and somehow getting it to apply to the new pages that have global-web/components/page/optionPage as their resourceType.  When I discovered yesterday that this wasn't working locally like I thought it was, I went and manually applied that property to the jcr:content node for the page I was trying to get to pull in.  When I did that, not only did it pull in, but all of the other optionPage's in the same directory also pulled into the component.  So, as a curiosity, I removed the cq:Taggable property and (after I restarted my local Publisher) it would not pull in again.  So, somehow, I need to make it so when someone selects the optionPage as the type of page they are trying to create that the cq:Taggable node = true property gets applied to the jcr:content node that is created.  Any suggestions on how to do that?