Expand my Community achievements bar.

SOLVED

Pagination for Site and Assets

Avatar

Level 2

Hi Team,

 

 

 

Can I know pagination for Sites and Assets.

 

 

How much limitation for the pagination?

 

example: if we have 100 pages in a site, how much it could be display for the first pagination. like 10 or 20 pages? 

 

Regards

Chandrika

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

If you are using query builder API to get those say those 100 pages , you can use parameter "offset" to get the results in chunks(10 or 20). please check this out.

 

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

 

How are you getting those 100 pages/assets? Just looping through the specific node or Query builder Search ?

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

If you are using query builder API to get those say those 100 pages , you can use parameter "offset" to get the results in chunks(10 or 20). please check this out.

 

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

 

How are you getting those 100 pages/assets? Just looping through the specific node or Query builder Search ?

Avatar

Community Advisor

Hi @chandrika123 , I am assuming that you are trying to add pagination for one of your page, so you should be able to decide it according to the business requirement and UX design.

Avatar

Community Advisor

If you are using querybuilder api, it will return all results with p.limit=-1 (this might be a high number depending on your instance).

If you want to implement pagination then you can use offset and limit like this

path=/content/<project>/us/en/products
type=cq:Page
property=jcr:content/@commerceType
property.value=Product Family
p.guessTotal=true
p.offset=0
p.limit=35

it will give you results 35 at one time. 

Results

Number of hits: 35+

p.guessTotal parameter is to return the appropriate number of results that can be shown by combining the minimum viable p.offset and p.limit values. The advantage of using this parameter is improved performance with large result sets.

p.limit- defines page size. In simple words how many records you want to fetch.

p.offset-defines start of index means from which index you want to fetch records from query result.

 

Below query will give you all results

path=/content/project/us/en/products
type=cq:Page
property=jcr:content/@commerceType
property.value=Product Family
p.limit=-1

Refer querybuilder cheat sheet- https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...