cts.estimate

cts.estimate(
   query as cts.query?,
   [options as String[]],
   [quality-weight as Number?],
   [forest-ids as (Number|String)[]],
   [maximum as Number?]
) as Number

Summary

Returns the number of fragments selected by a search. This can be used as a fast estimate of the number results.

Parameters
query A cts:query specifying the search to perform. If a string is entered, the string is treated as a cts.wordQuery of the specified string.
options Options to this search. The default is (). See cts.search for details on available options.
quality-weight A document quality weight to use when computing scores. The default is 1.0.
forest-ids 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 cts:search with this parameter and an empty cts:and-query to specify a forest-specific XPath statement (see the third example below). If you use this to constrain an XPath to one or more forests, you should set the quality-weight to zero to keep the XPath document order.
maximum The maximum value to return. Stop selecting fragments if this number is reached.

Example

  cts.estimate(cts.wordQuery("unsually"))
   => 10476
Powered by MarkLogic Server | Terms of Use | Privacy Policy