Loading TOC...


   [node as Node],
   [output-kind as String]
) as Object


Return the relevance score computation report for a node.

node A node. Typically this is an item in the result sequence of a cts.search operation. If this parameter is omitted, the context node is used.
output-kind The output kind. It can be either "object" or "element". With "object", the built-in returns an object. With "element", the built-in returns an XML element node. The default is "object".

Usage Notes

This function returns a JavaScript object that contains details about the score computation only if the following conditions are met: The node parameter or context node is the result of a cts.search call that included the relevance-trace option; and the score is non-zero. For example, you will not get a report if you use the score-zero option on your cts.search, if the search returns no results, or if node is not the result of cts.search.

The score computation reflects the scoring method specified in the cts.search expression, if any. The score-zero and score-random methods do not generate a report.

Collecting score computation details with which to generate this report is costly, so using the relevance-trace option will slow down your search significantly.


const x = cts.search("dog", ["relevance-trace"]).toArray();

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.