Improving a query, ordering by multiple items in query--not seeing a difference.
Hi Everyone,
I am working on a project improving the search results for a "related stories" component in our news system. Here is a simplified query that shows how our current search functions.
path=/content/uc/news/articles
type=cq:Page
tagid.1_value=topics:student-experience
tagid.2_value=colleges:nursing
tagid.3_value=helpful-marketing:current-bearcats
tagid.4_value=helpful-marketing:student-life
tagid.property=@jcr:content/cq:tags
tagid.property.and=false
orderby=@jcr:content/dispDate
orderby.sort=desc
You can see the draw back, it's finding any stories with any tag and sorting by the display date, which means that a recent story that maybe only shares one tag would appear before another older story which could share all of the tags.
By changing the orderby parameter to jcr:score I can already see an improvement, however, since we have something like 32,000 news stories over 20+ years, basing it on just the score could lead to a situation where an older story that has the same score as a younger story would appear first.
path=/content/uc/news/articles
type=cq:Page
tagid.1_value=topics:student-experience
tagid.2_value=colleges:nursing
tagid.3_value=helpful-marketing:current-bearcats
tagid.4_value=helpful-marketing:student-life
tagid.property=@jcr:content/cq:tags
tagid.property.and=false
orderby=@jcr:score
orderby.sort=desc
So I have tried using multiple order by clauses, as show below, but this query behaves the same as my original search: stories with the more recent display date are always appearing first. Swapping hte 1_ and 2_ prefix has no effect
path=/content/uc/news/articles
type=cq:Page
tagid.1_value=topics:student-experience
tagid.2_value=colleges:nursing
tagid.3_value=helpful-marketing:current-bearcats
tagid.4_value=helpful-marketing:student-life
tagid.property=@jcr:content/cq:tags
tagid.property.and=false
2_orderby=@jcr:content/dispDate
2_orderby.sort=desc
1_orderby=@jcr:score
1_orderby.sort=desc
.
All of these have been tested in the querydebugger and the xpath generated does contain both order by statements. Swapping 1 and 2 does rearrange the xpath order by but has no effect on the results.
Is there an additional statement I can use to sort this the way I'm aiming to?
Alternatively, is there a better way to do a best match style search?
Thanks.
