COUNT nodes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 05:19 AM
We're launching queries like that:
TYPE:"ts:FolderSet" and ANCESTOR:"workspace://StoreSpaces/234230..."
We need to count how many nodes are matching above condition instead of getting a list of nodes.
We're launching this query using /share TFS-Alfresco queries.
Any ideas?
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 06:51 AM
Yeah. Since this type of query will have to use the SOLR index, simply use the "numberFound" attribute contained in the search response / result set. That gives you the total number of nodes matching that query (that the current user is allowed to see). You can always set the "maxItems" parameter for search to 1, so you don't get a lot of results back (can't set it to zero though).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2019 04:23 AM
I don't quite figure out how to get this "numberFound" field.
I've tried something like that, but I don't see the number of nodes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2019 04:29 AM
You cannot from the Node Browser tool. You need to access the low-level ResultSet obtained by searching via the SearchService#query (Java) or Search#query (JavaScript) API operations. Alternatively, if you are looking for the whole number without permission checks (you are checking as admin after all), you can simply do a database query or check the SOLR index (schema browser) via its admin UI.
