Expand my Community achievements bar.

SOLVED

AEM6.3 group results in Query Builder

Avatar

Level 3

Hi,

I am implementing a search with query builder. I am retrieving content from the last 12 months, but I wish I could group the results per month.

Looking on the internet I could just find grouping to combine more than one search criteria.

Is it posible to group the results by month with query builder?

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

It is not possible to group on the month basis.

We would need to execute the query for each months daterange.

Once you have the details of each month, collect the required details in a proper data structure.

Then use this data structure to display/consume results as needed 


Aanchal Sikka

View solution in original post

3 Replies

Avatar

Community Advisor

I don't think you can do that, but you can sort it in asc or dsc order. I would suggest you to write a custom code to group your results month wise. After fetching the results of your query, using your back-end code , group them however you want.

Avatar

Level 9

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content]) and s.[cq:lastModified] >= '2013-06-11T14:06:50.197+01:00' and s.[cq:lastModified] >= '2014-06-11T14:06:50.197+01:00'

ir https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co...

Avatar

Correct answer by
Community Advisor

It is not possible to group on the month basis.

We would need to execute the query for each months daterange.

Once you have the details of each month, collect the required details in a proper data structure.

Then use this data structure to display/consume results as needed 


Aanchal Sikka