MarkLogic 9 Product Documentation
cts.contains

cts.contains(
   nodes as Sequence,
   query as cts.query
) as Boolean?

Summary

Returns true if any of a sequence of values matches a query.

Parameters
nodes The nodes or atomic values to be checked for a match. Atomic values are converted to a text node before checking for a match, which may result in an error if the value cannot be converted. If you pass in a single value, it is treated as a Sequence with that single item; therefore, if you pass in an array, the function will return the array. If you mean to check the values of each item in the array, then you can call xdmp.arrayValues on the array.
query A query to match against. If a string is entered, the string is treated as a cts:word-query of the specified string.

Example

const j = {"my-property":"hello"} ;
cts.contains(j, cts.jsonPropertyWordQuery("my-property", "hello"))

// returns true
Powered by MarkLogic Server | Terms of Use | Privacy Policy