Most Viewed and Liked Documents in alfresco

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Most Viewed and Liked Documents in alfresco

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.

Like (0)  Reply Actions 
3 Replies
Highlighted
Master

Re: Most Viewed and Liked Documents in alfresco

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.

Highlighted
Active Member II

Re: Most Viewed and Liked Documents in alfresco

Hi afaust Moderator,

Can you please suggest me, to find API for Most Viewed documents and Liked Documents ..?

Highlighted
Senior Member II

Re: Most Viewed and Liked Documents in alfresco

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"].