Resolving Tags in AEM6.5 | Adobe Higher Education
Skip to main content
Level 6
October 11, 2023
Beantwortet

Resolving Tags in AEM6.5

  • October 11, 2023
  • 1 Antwort
  • 557 Ansichten

When I resolve tags using the following code I get them in format: blog : something management / themeninvestments 

String QUERY2 = "SELECT * FROM [cq:Tag] AS tag WHERE (ISDESCENDANTNODE(tag, '/content/cq:tags/blog') OR ISDESCENDANTNODE(tag, '/content/cq:tags/zkb/content/blog')) AND tag.[sling:resourceType] = 'cq/tagging/components/tag'";

resourceResolverUsageService.withServiceUserResourceResolver(ServiceUser.CONTENT_READER, resolver -> {


List<String> tags = StreamUtil.iteratorStream(resolver.findResources(QUERY2, Query.JCR_SQL2))
.map(r -> r.adaptTo(Tag.class))
.map(tag -> tag.getTitlePath().toLowerCase())
.collect(Collectors.toList());
tagNames.addAll(tags);

 When I on the other hand get the tag from Sling 

sling:resourceType="cq/gui/components/coral/common/form/tagfield"

 they appear as blog:something-management/themeninvestments 

 

 

Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von aanchal-sikka

Hello @anasustic 

 

Can you please try by switching the API from "getTitlePath"  to "getTagID()"

1 Antwort

aanchal-sikka
Community Advisor
Community Advisor
October 11, 2023

Hello @anasustic 

 

Can you please try by switching the API from "getTitlePath"  to "getTagID()"

Aanchal Sikka
Level 6
October 11, 2023

Thank you so very much @aanchal-sikka That was it!