Loading TOC...

MarkLogic 12 EA 2 Product Documentation
cts.quality

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

Summary

Returns the quality 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

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

Example

//  assume a document created as follows:
//  declareUpdate();
//  xdmp.documentInsert("/test.json", {"a":"my test"}, null, null, 50);
for (const x of cts.search("my test")) {
  cts.quality(x);
};

=> 50

Example

for (const a of cts.search("my test")) {
  if (cts.quality(a) > 10) {
    xdmp.nodeUri(a);
  };
};

=> /test.json

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