<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.reverseQuery.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.reverseQuery</api:function-name><api:suggest>cts.reversequery</api:suggest><api:suggest>cts</api:suggest><api:suggest>reversequery</api:suggest><api:function-link mode="xquery" fullname="cts:reverse-query">/apidoc/8.0/cts:reverse-query.xml</api:function-link><api:function mode="javascript" name="reverseQuery" type="builtin" lib="cts" category="SearchBuiltins" subcategory="cts:query Constructors" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.reverseQuery"><api:summary>
  Returns a query matching the model nodes.  Use with a <code xmlns="http://www.w3.org/1999/xhtml">cts:search</code>
 or a <code xmlns="http://www.w3.org/1999/xhtml">cts:contains</code> over serialized <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> nodes.
 The serialized <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> nodes can be either stored in the
 database or passed in as XML.
</api:summary><api:params><api:param name="nodes" type="node()*"><api:param-description>
    Some model nodes that contain <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> XML nodes.  You can
    create <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> XML nodes in XQuery by wrapping a
    <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> constructor in an XML node:
    <pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
    &lt;foo&gt;{cts:word-query("my search")}&lt;/foo&gt;/&amp;#42;
    </pre>
  </api:param-description><api:param-name>nodes</api:param-name><api:param-type>Node[]</api:param-type></api:param><api:param name="weight" type="xs:double?" optional="true"><api:param-description>
    A weight for this query.
    This parameter has no effect on <code xmlns="http://www.w3.org/1999/xhtml">cts:reverse-query</code>
    because <code xmlns="http://www.w3.org/1999/xhtml">cts:reverse-query</code> does not contribute to score;
    that is, the score is always 0.
  </api:param-description><api:param-name>weight</api:param-name><api:param-type>Number?</api:param-type></api:param></api:params><api:return>cts.reverseQuery</api:return><api:usage>
   When performing a <code xmlns="http://www.w3.org/1999/xhtml">cts:reverse-query</code> on a set of nodes, the
   <code xmlns="http://www.w3.org/1999/xhtml">cts:similar-query</code> or <code xmlns="http://www.w3.org/1999/xhtml">cts:registered-query</code>
   components of any stored query will match all nodes.
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var query = cts.wordQuery("hello");
var obj = new Object();
obj.query = query;
var x = xdmp.toJSON({bar:"hello"});
cts.contains(obj, cts.reverseQuery(x));

// returns true because the cts.wordQuery for "hello"
// would match the document in x

</pre></api:example></api:function></api:function-page>