MarkLogic server side API, Javascript, cts.search, search only in specific nodes -
in marklogic xquery server side api there possibility run cts.search method in following manner: cts:search(//speech, cts:word-query("with flowers")) => ... sequence of 'speech' element ancestors (or self) of node containing phrase 'with flowers'. my question is, possible achieve such result using javascript api? namely, able run word-query on specific root-level nodes (as database hosts couple of different document types). (as nodes mentioned root nodes, using elementwordquery not seem handy way achieve goal). in javascript version of cts.search there no expression parameter xquery api . search words within specific element , text descendants, can use cts.elementwordquery . example, var resultsiterator = cts.search(cts.elementwordquery(xs.qname('speech'), 'with flowers')); for(var doc of resultsiterator) { // … } this iterates through each of documents. contained speech element, use doc.xpath('