In MarkLogic, is there a way to construct a CTS query from a JSON serialization thereof in XQuery (without having to invoke JavaScript)? I only see a JSON example using JavaScript (and XML using XQuery) but not a JSON example using XQuery here: https://docs.marklogic.com/guide/search-dev/cts_query#id_17645
I successfully got the desired result when I ran the following code, but I would like to do this in just XQuery instead:
let $script := 'var json; cts.query(fn.head(xdmp.fromJsonString(json)))'
return
xdmp:javascript-eval($script, map:entry("json", '{"wordQuery":{"text":["hello"], "options":["lang=en"]}}'))
Can it be done?