Deepak Talape
Deepak Talape

Reputation: 997

How to get specific content type document count from alfresco share UI using Lucene query

How to get specific content type document count in alfresco share UI using Lucene query?

I have tried to query in alfresco share UI Alfresco Lucene query. but it's only giving first 100 results.

Is there any best way to get only document count by specific content type or document count under specific alfresco site??

Please suggest if there is any other best and useful way.

Thanks in Advance.

Upvotes: 3

Views: 1533

Answers (3)

Marco Altieri
Marco Altieri

Reputation: 3818

The class PatchDAO has a method that returns the number of node with a given type:

/**
 * Gets the total number of nodes which match the given Type QName.
 * 
 * @param typeQName the qname to search for
 * @return count of nodes that match the typeQName
 */
public long getCountNodesWithTypId(QName typeQName);

where typeQName is, of course, the QName of the type.

This method should return the total count and should be the most efficient.

UPDATE: If you need the count on a specific site this method is not actually usable.

Upvotes: 3

Jeff Potts
Jeff Potts

Reputation: 10538

Hitting the database directly is a very bad idea, so don't even start getting into that bad habit.

Using the Alfresco foundational Java API would require that the Java class be deployed to the server, which is a pain.

The easiest way to do this is to use OpenCMIS. You can run OpenCMIS code remotely, and you can use its paging result set to page through the query results, see Apache CMIS: Paging query result

Upvotes: 2

Kintu Barot
Kintu Barot

Reputation: 320

ResultSet result = searchService.query(, SearchService.LANGUAGE_LUCENE, "+PATH:\"/app:company_home/cm:" + + "/*\"" + " +TYPE:\"" + + "\"" );

You can change the parameters as per your need.

Thanks,

Kintu

Upvotes: 2

Related Questions