Expand my Community achievements bar.

SOLVED

Find out number of assets

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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 -

DEBAL_DAS_0-1649333658616.png

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.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

 

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

Avatar

Level 1

Hi Ravi_Pampana, 

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

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

Avatar

Correct answer by
Employee Advisor

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 -

DEBAL_DAS_0-1649333658616.png

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.