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
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @anasustic
Can you please try by switching the API from "getTitlePath" to "getTagID()"
Hello @anasustic
Can you please try by switching the API from "getTitlePath" to "getTagID()"
Thank you so very much @aanchal-sikka That was it!