Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get the total number of objects (files or folders) of a particular type in Alfresco. This helps bypass Alfresco's query limit of 1000.
// Get the total number of objects of one type.
// This accounts for the query limits in Alfresco (which is 1000 results by default)
var query = 'TYPE:"myco:document"';
var totalNumOfDocs = 0;
do {
var page = {
maxItems: 1000,
skipCount: totalNumOfDocs
var def = {
query: query,
store: "workspace://SpacesStore",
language: "lucene",
page: page
var nodes = search.query(def);
totalNumOfDocs += nodes.length;
} while (nodes.length > 0);
logger.log("TOTAL NUMBER OF DOCS: " + totalNumOfDocs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.