Loading TOC...

cts.exists

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

Summary

Returns true if any fragment is selected by the search, false if no fragments are selected. This can be used as a fast existence check.

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 the 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 null value means to search all forests in the database. The default is null.

Example

  cts.exists(cts.wordQuery("something here"))
   => true

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.