Find out number of assets | Community
Skip to main content
New Participant
Apr 7, 2022 3:58 AM UTC
Solved

Find out number of assets

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.
DEBAL_DAS
DEBAL_DASAccepted solution
New Participant
Apr 7, 2022 12:16 PM UTC

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.

3 replies

Ravi_Pampana
New Participant
Apr 7, 2022 4:26 AM UTC

Hi,

 

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

Translate
Mon0904_Author
New Participant
Apr 7, 2022 5:22 AM UTC

Hi Ravi_Pampana, 

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

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

Translate
DEBAL_DAS
DEBAL_DASAccepted solution
New Participant
Apr 7, 2022 12:16 PM UTC

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.

Translate