Hi All,
I have about 10k DAM assets that all require me to add a set of cq:tags to them.
I have tried exporting the dam metadata adding the tags to the .csv and reimporting that (Column 'cq:tags' - Tags 'example:AU/NSW')
Once I import it and check on an assets properties I do not see the tag in the tags field. However, if I export the metadata again after doing the above I can see in the cq:tags column the tags I imported.. which is a tad confusing.
Any ideas what I might be missing here?
Kindest Regards,
Solved! Go to Solution.
Views
Replies
Total Likes
Ah I have found out why it was behaving badly...
When I export the metadata from the DAM its calls the column cq:tags{{String}} when it should be cq:tags{{String: multi }} and it separates tags with ; when it should be using |
Making these changes to my .csv file has resulted in the tags now appearing on my assets
Hi Mate,
Yep. The tags are under /content/cq:tags
Hi @RooRue ,
Could you please check the below points?
->When you are importing metadata make sure you are using the correct settings, and mapping in the column, Also ensure you are importing CSV files in the appropriate location and check for the import assets permission is correct.
->The 'cq:tags' property in AEM is a multivalued property, meaning it can hold multiple tag values,make it sure the setting of cq:tags property as a list of tags in the CSV file.
->Verify that the 'example' namespace used in the CSV matches the actual namespace defined in AEM for the tags
Hi @Ekhlaque
In this same spreadsheet if i adjust the dc:title it does actually apply that to the asset properties.
The tags i am trying to add are from this path - /content/cq:tags/example/CV/JGS
this is the column in my .csv that im trying to import.
Can you please share the headings and some values of your csv file?
there might be 2 reasons.
1. the tags that you added in ca:tags property does not exist under /content/cq:tags
2. Check the property type if you are using Multi values.
Multi Value Property format - <metadata property name> {{<property type : MULTI }}
Hi Nishant-Singh,
Here is the tags column in my .csv and also a snippet for how the tags look in devs crxde -
Hi @RooRue,
I have done bulk tagging for pages. You will get an idea from this.
Resource contentResource = page.getContentResource();
Node contentNode = contentResource.adaptTo(Node.class);
if (contentNode != null) {
ValueFactory valueFactory = session.getValueFactory();
if (contentNode.hasProperty(PAGE_TAG)) {
Property pageTagProperty = contentNode.getProperty(PAGE_TAG);
Value[] existingValues = pageTagProperty.getValues();
List<Value> updatedValues = new ArrayList<>(Arrays.asList(existingValues));
updatedValues.add(0, valueFactory.createValue(tag.getTagID()));
pageTagProperty.setValue(updatedValues.toArray(new Value[0]));
} else {
List<Value> updatedValues = new ArrayList<>();
updatedValues.add(valueFactory.createValue(tag.getTagID()));
contentNode.setProperty(PAGE_TAG, updatedValues.toArray(new Value[0]));
}
resourceResolver.commit();
}
In asset, we have cq:tags under metadata. So you need to update this property.
Make sure the property is multivalued.
adapt that resource to the Node class and set the property by updating Value.
NB: This code snippet is for updating the tags for pages.
Hello @RooRue
It might be a data issue.
Validating Tag ID:
For one of the assets, where the tag is set, but not visible, try adding an existing tag again (one that was added via Excel also).
Validating access to Tags
Hi Aanchal-Sikka,
I have taken one of the documents I was testing (the one that I tried importing tags into) and manually added a tag via the properties. When I close and open that tag is still visible and is the only tage visible on that document in CRXDE.
When I got back to the documents folder and grab a new metadata export and add tags to it again it removes even the tag I had manually put there. Infact it's removing all the tags from all the documents in that folder. (Edit - Although the tags still show in the metadata export.. Just not on the documents properties page)
Ah I have found out why it was behaving badly...
When I export the metadata from the DAM its calls the column cq:tags{{String}} when it should be cq:tags{{String: multi }} and it separates tags with ; when it should be using |
Making these changes to my .csv file has resulted in the tags now appearing on my assets
Views
Likes
Replies
Views
Likes
Replies