Loading TOC...

op:prepare

op:prepare(
   $plan as map:map,
   $optimize as xs:unsignedShort
) as map:map

Summary

This method prepares the specified plan for execution as an optional final step before execution.

Parameters
$plan The Optic Plan. You can either use the XQuery => chaining operator or specify the variable that captures the return value from the previous operation.
$optimize The optimization level, which can be 0, 1, or 2 (with 1 as the default).

Example


import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $employees := op:from-view("main", "employees")
 
return $employees             
   => op:select(())
   => op:prepare(2) 
   => op:result()  
    
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.