服务器端 JavaScript 中的 MarkLogic search.search 是否支持 JSON 选项?

Does MarkLogic search.search in server-side JavaScript support JSON options?

MarkLogic 文档指出搜索选项可以用 JSON 表示 "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.

参考:https://docs.marklogic.com/guide/search-dev/appendixa#id_94988

我猜这不包括服务器端 JavaScript 中的 search.search 功能?因为像 search.search('apple', {...}) 这样的东西会导致 Invalid coercion: object-node{...} as element(search:options) 错误。

这有点奇怪,因为许多其他 MarkLogic JavaScript 函数支持 JSON(或 JS 对象)作为选项参数。我错过了什么吗?

REST API 支持 JSON 等效于 XML 查询选项和搜索 API 接受的结构化查询。

文档显示了查询选项和结构化查询的 XML 和 JSON 序列化:

http://docs.marklogic.com/guide/search-dev/appendixa#id_94988

http://docs.marklogic.com/guide/search-dev/structured-query#id_85307

顺便说一下,如果你想在服务器端搜索 JavaScript,看看 JSearch:

http://docs.marklogic.com/guide/search-dev/javascript

http://docs.marklogic.com/js/jsearch

JSearch 设计用于服务器端 JavaScript(其中 Search API 设计用于 XQuery)。

希望对您有所帮助,