<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.quality.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.quality</api:function-name><api:suggest>cts.quality</api:suggest><api:suggest>cts</api:suggest><api:suggest>quality</api:suggest><api:function-link mode="xquery" fullname="cts:quality">/apidoc/8.0/cts:quality.xml</api:function-link><api:function mode="javascript" name="quality" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Search" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.quality"><api:summary>
  Returns the quality of a node,
  or of the context node if no node is provided.
</api:summary><api:params><api:param name="node" type="node()" optional="true"><api:param-description>
    A node. Typically this is an item in the result sequence of a
    
    <code class="javascript" xmlns="http://www.w3.org/1999/xhtml">cts.search</code> operation.
  </api:param-description><api:param-name>node</api:param-name><api:param-type>Node</api:param-type></api:param></api:params><api:return>Number</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If you run 
  <code class="javascript">cts.quality</code> 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 
  <code class="javascript">cts.search</code> result or an
  item from the result of an XPath expression that searches through the
  database).</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
//  assume a document created as follows:
//  declareUpdate();
//  xdmp.documentInsert("/test.json", {"a":"my test"}, null, null, 50);
for (var x of cts.search("my test")) {
cts.quality(x);
};

=&gt; 50
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
for (var a of cts.search("my test")) {
  if (cts.quality(a) &gt; 10) {
    xdmp.nodeUri(a);
  };
};

=&gt; /test.json
</pre></api:example></api:function></api:function-page>