Query Builder with Multiple Paths - Sort Order Seems Incorrect | Community
Skip to main content
March 23, 2023
Solved

Query Builder with Multiple Paths - Sort Order Seems Incorrect

  • March 23, 2023
  • 1 reply
  • 1402 views

I am grouping 2 paths for a query, and the results that come back always display results from the first path first, then followed by the second path, regardless of the jcr:score.

My goal is to have combined results, sorted by jcr:score.

Results always come back in this way, with results ordered by jcr:score within the path. Can the results come back so the results are only based on score?

Results:
path1 score: 10
path1 score: 5
path1 score: 1
path2 score: 9
path2 score: 6
path2 score: 3
path2 score 1

Desired:
path1 score: 10

path2 score: 9

path2 score: 6

path1 score: 5
path2: score: 3

path1: score 1

path2: score 1

This is my actual query:

 

fulltext=searchterm
group.0_path=/content/section1
group.0_path.self=true
group.1_path=/content/section2
group.1_path.self=true
group.p.or=true
orderby=@jcr:score
orderby.sort=desc
property=jcr:content/excludeFromSearch
property.operation=not
2_property=jcr:content/cq:redirectTarget
2_property.operation=not
type=cq:Page
p.limit=-1
p.excerpt=true
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 Nitin_laad

Hi @hn_doug 

Can you remove the "group.p.or=true" parameter and add the "orderby=@jcr:score" parameter outside of the grouping block and verify

fulltext=searchterm group.0_path=/content/section1 group.0_path.self=true group.1_path=/content/section2 group.1_path.self=true orderby=@jcr:score orderby.sort=desc property=jcr:content/excludeFromSearch property.operation=not 2_property=jcr:content/cq:redirectTarget 2_property.operation=not type=cq:Page p.limit=-1 p.excerpt=true

 

 

1 reply

Nitin_laad
Community Advisor
Nitin_laadCommunity AdvisorAccepted solution
Community Advisor
March 23, 2023

Hi @hn_doug 

Can you remove the "group.p.or=true" parameter and add the "orderby=@jcr:score" parameter outside of the grouping block and verify

fulltext=searchterm group.0_path=/content/section1 group.0_path.self=true group.1_path=/content/section2 group.1_path.self=true orderby=@jcr:score orderby.sort=desc property=jcr:content/excludeFromSearch property.operation=not 2_property=jcr:content/cq:redirectTarget 2_property.operation=not type=cq:Page p.limit=-1 p.excerpt=true

 

 

HN_DougAuthor
April 11, 2023

without group.p.or=true, I had zero results. adding that back in fixed it. Otherwise, it's working as needed. Thank you.