cancel
Showing results for 
Search instead for 
Did you mean: 

How to find total number of document uploaded in repository?

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

Is there any way i can get total number of content documents uploaded in Alfresco repository by all existing users.

I found one db query but it does not seem to give correct ouptut.

SELECT count(*) FROM alfresco.alf_node a where type_qname_id=35;

where 35 is id for content in alfresco.alf_qname table.

I want total number of documents uploaded either via 'Add Content' in Alfresco explorer or using WebDav or any other mechanism.

I think i am missing something. :!:

Any web script or java script or service api or any db query will do?

Would appreciate for any help!
7 REPLIES 7

ivan_plestina
Champ in-the-making
Champ in-the-making
Best way is the one you have tried. You might get incorrect results because of deleted content. So limit your query to workspaceSmiley FrustratedpacesStore e.g. AND store_id=<id>.

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi Ivan,

Thanks for your help.

Below is updated query to get all content for "workspace:spacestore" :

SELECT count(*) FROM alfresco.alf_node a where type_qname_id=35 and store_id=6;

Smiley Tongue

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

I used a webscript to get total number of content in repository as DB thingy was not accurate all the times. :?:

Here is the code for same:

var contentDocs = search.luceneSearch("TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"");
var totalCnt = contentDocs.length;

To get it rendered , i used model array variable in ftl:

model.allContent = totalCnt ;

Smiley Happy

chapeaurouge
Champ in-the-making
Champ in-the-making
Didn't you run in the 1000 limit with the webscript?

I have over 100,000 documents, but unless I change system.acl.maxPermissionChecks and system.acl.maxPermissionCheckTimeMillis to higher numbers, there is apparently no way.

I read another post where, in java, one could use a fetchSize() method to split the resultSet, but I don't know how to do it in javascript.. If anyone has insights.

Anyways, for a repository that gets really large, it may just take too long to return. I have also written a database stored procedure to get the total number of documents, by types.

themarcuz
Champ in-the-making
Champ in-the-making
Hi all,
I'm trying to do quite the same thing, but I have to retrieve the number of content's uploaded per user.
The direct db query seems interesting, but where could you do that? You have to write your java code and access directly to the db, or you can use some kind of Alfresco API that support sql queries?

chapeaurouge
Champ in-the-making
Champ in-the-making
You can write a webscript which, instead of using a javascript, uses a traditional java class (java backed web script)

chapeaurouge
Champ in-the-making
Champ in-the-making
I have posted a couple things in my blog

http://ironman.darthgibus.net/?cat=23

But I haven't written the webscript yet.