<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.score.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.score</api:function-name><api:suggest>cts.score</api:suggest><api:suggest>cts</api:suggest><api:suggest>score</api:suggest><api:function-link mode="xquery" fullname="cts:score">/apidoc/8.0/cts:score.xml</api:function-link><api:function mode="javascript" name="score" type="builtin" lib="cts" category="SearchBuiltins" subcategory="Search" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.score"><api:summary>
  Returns the score 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">Score is computed according to the scoring method specified in the
  
    <code class="javascript">cts.search</code> expression, if any.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If you run 
  <code class="javascript">cts.score</code> 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).</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var res = new Array();
var s = fn.subsequence(cts.search("bar"), 1, 10);
for (var item of s) {
 res.push(cts.score(item));
}
res;
// returns the scores for the first 10 results that match the search
</pre></api:example></api:function></api:function-page>