search.resolve( query as Node, [options as element(search.options)?], [start as (Number|String)?], [page-length as (Number|String)?] ) as element(search.response)
This function is the same as
search:search
, except that it takes
a parsed and annotated cts:query
XML node or a
structured search search:query
XML node as
input.
Parameters | |
---|---|
query |
A cts:query object, a serialized cts:query , or
a structured query (search:query ).
You can generate any of these forms of query using
search:parse.
|
options | Options to define the search
grammar and control the search. See the description for
$options
for the function search:search .
|
start | The index of the first hit to return. The default is 1. |
page-length | The maximum number of hits to return. The default is 10. If the value is 0, no results are returned. |
const search = require('/MarkLogic/appservices/search/search'); search.resolve(search.parse('Vannevar Bush'), fn.head(xdmp.unquote('<options xmlns="http://marklogic.com/appservices/search">' + '<return-results>false</return-results>' + '<return-facets>true</return-facets>' + '</options>')).root);
// Structured query example, plain search for "hello". const search = require('/MarkLogic/appservices/search/search'); const structQuery = fn.head(xdmp.unquote('<query xmlns="http://marklogic.com/appservices/search">' + '<term-query>' + '<text>hello</text>' + '</term-query>' + '</query>')).root; search.resolve(structQuery); // Returns a search:response node that matches a query for "hello".
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.