Loading TOC...


   $plan as map:map,
   $uriCol as item(),
   $fragmentIdCol as item()
) as map:map


This method adds a uri column to rows based on an existing fragment id column to identify the source document for each row. The fragmentIdCol must be an op:fragment-id-col specifying a fragment id column. If the fragment id column is null in the row, the row is dropped from the rowset.

You should minimize the number of documents retrieved by filtering or limiting rows before joining documents.

$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.
$uriCol The document uri. This is the output from op:col('uri') that specifies a document uri column.
$fragmentIdCol The document fragment id value. This is the output from op:fragment-id-col specifying a fragment id column.


xquery version "1.0-ml";

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

let $empldocid := op:fragment-id-col("empldocid") 
return op:from-view("main", "employees", (), $empldocid)
     => op:join-doc-uri(op:col("uri"),  $empldocid)
     => op:result()


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