cts.score

cts.score(
   [node as Node]
) as Number

Summary

Returns the score of a node, or of the context node if no node is provided.

Parameters
node A node. Typically this is an item in the result sequence of a cts.search operation.

Usage Notes

Score is computed according to the scoring method specified in the cts.search expression, if any.

If you run cts.score on a constructed node, it always returns 0; it is primarily intended to run on nodes that are retrieved from the database (an item from a search result or an item from the result of an XPath expression that searches through the database).

Example

const res = new Array();
const s = fn.subsequence(cts.search("bar"), 1, 10);
for (const item of s) {
 res.push(cts.score(item));
}
res;
// returns the scores for the first 10 results that match the search
Powered by MarkLogic Server | Terms of Use | Privacy Policy