Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Querying jcr:score

Avatar

Level 1

Good morning team.

I'm trying to retrieve the value of jcr:score for a full text search, but I'm not able to see the value using the following query

is there a way to see this value in a query?


Regards.

5 Replies

Avatar

Employee

You can use JCR Query Cheat Sheet [1] to build your query. It might be easier to build a SQL/SQL2 query then you can generate the xpath query from the SQL query in CRX/DE

[1] https://wiki.magnolia-cms.com/display/WIKI/JCR+Query+Cheat+Sheet

Avatar

Level 1

Thanks for your reply Hamid.

I'm using the query debugger (http://localhost:4502/libs/cq/search/content/querydebug.html​ ) to run the query and I'm able to see some properties clicking on the link JSON QueryBuilder Link​​​, but the jcr:score property is never shown in any of the values in the JSON.

Also the generated Xpath is

/jcr:root/content/stantec//element(*, cq:PageContent)

[

(jcr:contains(., 'David Dixon')

and @jcr:title)

]

Avatar

Employee

This could potentially be due to JSON Max results i.e. json.maximumresults, [1] assuming the query is fine. When this limit is exceeded the rendering will be collapsed.

[1] Security Checklist

Avatar

Level 1

the JSON is not that deep

{

  • success: true,
  • results: 8,
  • total: 8,
  • more: false,
  • offset: 0,
  • hits:

    [

    • {
      • path: "/content/stantec/en/markets/urban-places/resilience/about-resilience/jcr:content",
      • excerpt: "a changing world Envision the future BACK →",
      • name: "jcr:content",
      • title: "About Resilience",
      • lastModified: "2018-03-01 12:13:54",
      • created: "2019-06-17 14:32:24"
      },
      .
      .
      .

     ]
}

Avatar

Level 2

did you ever get a valid response to this? I am having the same issue and when I try to render the jcr:score as an attribute of the results - everything has a score of 0.01

I'm baffled.