MarkLogic 12 EA 1 Product Documentation
cts.fitness

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

Summary

Returns the fitness of a node, or of the context node if no node is provided. Fitness is a normalized measure of relevance that is based on how well a node matches the query issued, not taking into account the number of documents in which the query term(s) occur.

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

Usage Notes

Fitness is similar to score, except that it is bounded. It is similar to confidence, except that it is not influenced by term IDFs. It is an xs:float in the range of 0.0 to 1.0. It does not include quality.

Example

const s = cts.search("dog");
for (const x of fn.subsequence(s, 1, 1) ) {
  cts.fitness(x);
};
// returns the fitness of the first "dog" hit
Powered by MarkLogic Server | Terms of Use | Privacy Policy