The MarkLogic documentation states that search options can be expressed in JSON for "selected Client APIs, such as the REST Client API":
A set of query options has the following structure. You can only use the JSON form with selected Client APIs, such as the REST Client API.
Ref: https://docs.marklogic.com/guide/search-dev/appendixa#id_94988
I guess this does not cover the search.search function in server-side JavaScript? Because something like search.search('apple', {...}) would result in Invalid coercion: object-node{...} as element(search:options) error.
This is a little odd as many other MarkLogic JavaScript functions support JSON (or JS Object) as the options parameter. Did I miss something?