Skip to main content
Level 2
August 30, 2024
Solved

Results are grouped based on multiple paths used within AEM Query Builder

When we do query search, results are grouped based on paths. 

For example, if we have queried for paths /content/us/en & /content/ca/en , then results will have group of pages from /us/en and after that it will have group of pages from /ca/en. Even if we try to sort orderby=@jcr:score , sorting is done for 1st set of pages from /us/en and after that it sorts pages from /ca/en, ideally it should be sorting for entire set of result.

 

Sample query:

fulltext=random text

group.1_path=/content/us/en

group.2_path=/content/ca/en

group.p.or=true

orderby=@jcr:score

orderby.sort=desc

 

Result :

0: /content/us/en/page1.html jcr:score = 1.50

1: /content/ca/en/page2.html jcr:score = 2.50

2: /content/ca/en/page3.html jcr:score = 1.20

 

Ideally it should be somewhat like:

0: /content/ca/en/page2.html jcr:score = 2.50

1: /content/us/en/page1.html jcr:score = 1.50

2: /content/ca/en/page3.html jcr:score = 1.20

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
h_kataria
h_katariaAccepted solution
Community Advisor
August 30, 2024

4 replies

somen-sarkar
Community Advisor
Community Advisor
August 30, 2024

Hi @akshaywa2 ,

Could you try the following query ? Highlighted part has been changed.

 

fulltext=random text

group.1_path=/content/us/en

group.2_path=/content/ca/en

group.p.or=true

orderby=@jcr:score

orderby.desc=true

 

Thanks,

Somen

 

Translate
AkshayWa2Author
Level 2
August 30, 2024

Thanks @somen-sarkar for quick response, it sorting but still in group, first group of result is from /us/en since our 1st path in query is /us/en and then second group is considered which is /ca/en which is 2nd path in our query and that is sorted separately

 

0: /content/us/en/page1.html jcr:score = 1.50

1: /content/ca/en/page3.html jcr:score = 1.20

2: /content/ca/en/page2.html jcr:score = 2.50

Translate
h_kataria
Community Advisor
h_katariaCommunity AdvisorAccepted solution
Community Advisor
August 30, 2024
kautuk_sahni
Level 9
August 30, 2024

@akshaywa2 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Translate
Kautuk Sahni