Tags in Liferay
In Liferay you can create Tag Sets, Create Tags within each Tag Set and assign properties to Tags.Once Creation is done, you can assign same tag to multiple assets.
This article describes how the tags data stored internally in Liferay. The Version i used is Liferay 52EE SP5
Use Case 1– Added a new Tag Set ‘My Tag Set’ , Added a new tag entry ‘sampleTAG’ within the ‘My Tag Set’ tag set. Assigned property ‘sampleTAGProperty1′ to the above tag.
Here are the tables where data will be inserted
1) TagsVocabulary – will store the Vocabularies (Tag Set), In this case MDEX
SELECT * FROM TagsVocabulary T where name = 'My Tag Set'
2) TagsEntry – Store the actual Tag Name, with a mapping with vocabularyId.
SELECT * FROM TagsEntry T where name = 'sampleTAG' && vocabularyId = (SELECT vocabularyId FROM TagsVocabulary T where name = 'My Tag Set' )
3) TagsProperty – Store the properties associated with a Tag.In this case data associated with ‘sampleTAGProperty1‘
Use Case 2 – Apply ‘sampleTAG’ tag a document library document.
Here are the tables where data will be inserted
4) TagsAsset – In Liferay Same tag can be applied to Web Content, Document Library document, Image Gallery etc.This tables stores, which tag is applied to which asset.
This table uses these 2 columns to differentiate
classNameId – This is the ID of the asset. This data is stored in ClassName table. If you query ClassName Table
SELECT * FROM ClassName_;
Find classNameId associated with this the className = com.liferay.portlet.documentlibrary.model.DLFileEntry. Same value will be there in TagsAsset.classNameId column for ‘sampleTag’
classNamePK – this is the primary key of the actual asset in picture. So in this case, above value will be fileEntryId in DLFileEntry table
Overall, classNameId is the asset type (Web Content, Image Gallry, Doc Lib etc) and classNamePK is the primary for the actual asset of that asset type.
5) TagsAssets_TagsEntries
This is mapping table for TagAsset and TagEntry table. It maps the assetId from TagAsset table with entryId is TagsEntry table
Hello Arvind Mishra,
Thanks for the nice article on Tags, Can you please post how to find all the Tags for a particular asset,a SQL query will help me.
Thanks
Micheal
Hello Arvind Mishra,
Thanks for the nice article on Tags, Can you please post how to find all the Tags for a particular asset,a SQL query will help me…
Thanks
Micheal
Nice Article
n