AEM6.3 group results in Query Builder | Community
Skip to main content
elizabethp60981
Level 3
February 25, 2018
Solved

AEM6.3 group results in Query Builder

  • February 25, 2018
  • 3 replies
  • 1365 views

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

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 aanchal-sikka

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 

3 replies

VeenaVikraman
Community Advisor
Community Advisor
February 26, 2018

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.

Hemant_arora
Level 8
February 26, 2018

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/com/day/cq/search/eval/PredicateEvaluator.html

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
October 24, 2023

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