[MarkLogic Dev General] cts.search v cts:search

Steiner, David J. (LNG-DAY) David.J.Steiner at elsevier.com
Tue Mar 3 11:56:00 PST 2015

I’m trying to implement a search in javascript.  In xquery, with cts:search you can specify an element to be searched and returned, such as: cts:search(//element.

The javascript cts.search doesn’t seem to have this ability.  Is there a way to affect this in javascript?  I really don’t want the whole doc coming back, just the element.  Yes, the element is a fragment.

Here’s the XQuery I’m trying to replicate in javascript:

for $hit in  cts:search(//word,



      "tenant for life",


order by fn:data($hit/../@year)


XML documents looks like this:

<concepts year="1865">

<word count="8">tenant for life</word>

<word count="5">decree of court</word>

<word count="4">fourth part</word>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20150303/91c8499f/attachment.html 

More information about the General mailing list