Loading TOC...

search:resolve

search:resolve(
   $query as element(),
   [$options as element(search:options)?],
   [$start as xs:unsignedLong?],
   [$page-length as xs:unsignedLong?]
) as element(search:response)

Summary

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
$queryEither a serialized and annotated cts:query, or a structured query (search:query). You can generate either form of query as the result of a call to search:parse.
$optionsOptions to define the search grammar and control the search. See the description for $options for the function search:search.
$startThe index of the first hit to return. The default is 1.
$page-lengthThe maximum number of hits to return. The default is 10. If the value is 0, no results are returned.

Example

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>

      

Example

(: 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"      
      

      

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy