search:resolve( $query as element(), [$options as element(search:options)?], [$start as xs:unsignedLong?], [$page-length as xs:unsignedLong?] ) 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. |
xquery version "1.0-ml"; import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; search:resolve(search:parse("Vannevar Bush"), <options xmlns="http://marklogic.com/appservices/search"> <return-results>false</return-results> <return-facets>true</return-facets> </options>) => <search:response total="1234" start="1" page-length="10" xmlns="" xmlns:search="http://marklogic.com/appservices/search"> <search:facet name="date"> <search:facet-value value="today" count="1000"> Today</search:facet-value> <search:facet-value value="yesterday" count="234"> Yesterday</search:facet-value> <search:facet-value value="thismonth" count="1234"> This Month</search:facet-value> <search:/facet> ... </search:response>
(: structured query example, plain search for "hello" :) xquery version "1.0-ml"; import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; let $struct-query := <query xmlns="http://marklogic.com/appservices/search"> <term-query> <text>hello</text> </term-query> </query> return search:resolve($struct-query) => returns the 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.