Hi Everyone,
By using this query i am getting document creator and created date
SELECT distinct n.audit_creator as creator,p.string_value as document_name,date(n.audit_created) as created_on
From alf_node AS n,alf_qname AS q,alf_node_properties as p
WHERE n.type_qname_id=q.id AND p.node_id=n.id AND p.qname_id IN (SELECT id FROM alf_qname WHERE local_name='name')
AND n.audit_creator not in('admin') AND n.audit_creator not in('System') AND q.local_name='content' AND p.string_value NOT LIKE '%.xml' order by created_on ASC;
i am getting like this
creator | document_name | created_on
----------+--------------------------+------------
Sandeep | Alfresco_User_Guide.docx | 2018-03-20
(1 row)
Like this i need to show list of most viewed and liked documents in alfresco, can anyone help out me please.
First of all, it is really not recommended to access the Alfresco database at a low level. What is wrong with just using the APIs that Alfresco provides for accessing the creator, creation date and name of a document? You can even use Alfresco query features to filter out any documents created by the System or admin users...
There is - by default and without any customisation - no tracking of the "most viewed" documents, so you cannot query for that out-of-the-box. The "like" rating is stored as a property on the document itself, so you can simply to a query for that and sort based on the value. The property in question should be cm:likesRatingSchemeCount.
Hi afaust ,
Can you please suggest me, to find API for Most Viewed documents and Liked Documents ..?
If you are using java , than you can use the nodeService to get the details of property.
if javascript than you can simply, use node.properties["cm:likesRatingSchemeCount"].
Hey,
I know this thread is old and I haven't figured out a suitable solution. However I got "closer". One can count the "ratings" associations. This way there is no filter for the node-type that was rated/liked, but at least this helps to somehow aggregate the amount of ratings/likes a node ("with a name" and "of any kind") got.
SELECT parent_node_id AS nodeDbId, nodeName.string_value AS nodeName, COUNT(parent_node_id) AS likes
FROM public.alf_child_assoc AS assocs
JOIN alf_node AS nodes ON (parent_node_id = nodes.id)
JOIN alf_node_properties nodeName ON (nodes.id = nodeName.node_id AND nodeName.qname_id IN (SELECT id FROM alf_qname WHERE local_name = 'name'))
JOIN alf_qname AS assocType ON (assocType.id = assocs.type_qname_id AND assocType.local_name = 'ratings')
GROUP BY parent_node_id, nodeName.string_value
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.