<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/cts.estimate.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>cts.estimate</api:function-name><api:suggest>cts.estimate</api:suggest><api:suggest>cts</api:suggest><api:suggest>estimate</api:suggest><api:function mode="javascript" name="estimate" type="builtin" lib="cts" category="Extension" subcategory="Search" class="javascript" hidden="false" bucket="MarkLogic Built-In Functions" prefix="cts" namespace="http://marklogic.com/cts" fullname="cts.estimate"><api:summary>
  Returns the number of fragments selected by a search.
  This can be used as a fast estimate of the number results.
</api:summary><api:params><api:param name="query" type="cts:query?"><api:param-description>
    A <code xmlns="http://www.w3.org/1999/xhtml">cts:query</code> specifying the search to perform.  If a string
   is entered, the string is treated as a <code xmlns="http://www.w3.org/1999/xhtml">cts.wordQuery</code> of the
   specified string.
  </api:param-description><api:param-name>query</api:param-name><api:param-type>cts.query?</api:param-type></api:param><api:param name="options" type="(cts:order|xs:string)*" optional="true"><api:param-description>
    Options to this search.  The default is ().
    See <a href="./cts.search" xmlns="http://www.w3.org/1999/xhtml"><code>cts.search</code></a>
    for details on available options.
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="quality-weight" type="xs:double?" optional="true"><api:param-description>
    A document quality weight to use when computing scores.
    The default is 1.0.
  </api:param-description><api:param-name>quality-weight</api:param-name><api:param-type>Number?</api:param-type></api:param><api:param name="forest-ids" type="xs:unsignedLong*" optional="true"><api:param-description>
    A sequence of IDs of forests to which the search will be constrained.
    An empty sequence means to search all forests in the database.
    The default is (). In the XQuery version, you can use
    <code xmlns="http://www.w3.org/1999/xhtml">cts:search</code> with this
    parameter and an empty <code xmlns="http://www.w3.org/1999/xhtml">cts:and-query</code> to specify a
    forest-specific XPath statement (see the
    <a href="./cts:search#searchEx3" xmlns="http://www.w3.org/1999/xhtml">third
    example</a> below). If you
    use this to constrain an XPath to one or more forests, you should set
    the <code xmlns="http://www.w3.org/1999/xhtml">quality-weight</code> to zero to keep the XPath document
    order.
  </api:param-description><api:param-name>forest-ids</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="maximum" type="xs:double?" optional="true"><api:param-description>
    The maximum value to return.
    Stop selecting fragments if this number is reached.
  </api:param-description><api:param-name>maximum</api:param-name><api:param-type>Number?</api:param-type></api:param></api:params><api:return>Number</api:return><api:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  cts.estimate(cts.wordQuery("unsually"))
   =&gt; 10476
</pre></api:example></api:function></api:function-page>