Find out number of assets | Community
Skip to main content
April 7, 2022
Solved

Find out number of assets

  • April 7, 2022
  • 1 reply
  • 854 views

Hi Team,

 

As part of referenceSearch.search , we are passing resolver and path. but it is deprecated now. We have two more additional parameters, limit and offset. In this case, we want to know the number of assets to set the limit. 

How to find the number of assets here?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by DEBAL_DAS

I could see ReferenceSearch api has below methods -

setMaxReferencesPerPage(int maxReferencesPerPage) to set the value of maxReferencesPerPage.

You could see below implementation how did they set the value of max references per pages -

http://experience-aem.blogspot.com/2015/07/aem-61-get-references-of-page-or-asset.html

 

But in query builder we can easily use offset and limit.

 

Please brief us about the actual requirement here.

1 reply

Ravi_Pampana
Community Advisor
Community Advisor
April 7, 2022

Hi,

 

Did you try passing limit as -1 to return all the references? 

Mon0904_Author
April 7, 2022

Hi Ravi_Pampana, 

You mean like this? referenceSearch.search(resourceResolver, assetPath, 0, -1)

if we pass like this, will it get all the assets?

DEBAL_DAS
DEBAL_DASAccepted solution
New Member
April 7, 2022

I could see ReferenceSearch api has below methods -

setMaxReferencesPerPage(int maxReferencesPerPage) to set the value of maxReferencesPerPage.

You could see below implementation how did they set the value of max references per pages -

http://experience-aem.blogspot.com/2015/07/aem-61-get-references-of-page-or-asset.html

 

But in query builder we can easily use offset and limit.

 

Please brief us about the actual requirement here.

Debal Das, Senior AEM Consultant