
cts.score( [node as Node] ) as Number
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.
|
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).
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
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.