MarkLogic Server 11.0 Product Documentation
cts.andQuery

cts.andQuery(
   queries as cts.query[],
   [options as String[]]
) as cts.andQuery

Summary

Returns a query specifying the intersection of the matches specified by the sub-queries.

Parameters
queries A sequence of sub-queries.
options Options to this query. The default is ().

Options include:

"ordered"
An ordered and-query, which specifies that the sub-query matches must occur in the order of the specified sub-queries. For example, if the sub-queries are "cat" and "dog", an ordered query will only match fragments where both "cat" and "dog" occur, and where "cat" comes before "dog" in the fragment.
"unordered"
An unordered and-query, which specifies that the sub-query matches can occur in any order.

Usage Notes

If the options parameter contains neither "ordered" nor "unordered", then the default is "unordered".

If you specify the empty sequence for the queries parameter to cts.andQuery, you will get a match for every document in the database. For example, the following query always returns true:

  cts.contains(fn.collection(), cts.andQuery([]))

In order to match a cts.andQuery, the matches from each of the specified sub-queries must all occur in the same fragment.

Example

cts.estimate(
  cts.andQuery([cts.wordQuery("to be or"),
                         cts.wordQuery("or not to be")]));
=> 1
Powered by MarkLogic Server | Terms of Use | Privacy Policy