Loading TOC...

op:from-doc-uris

op:from-doc-uris(
   $query as item()*,
   [$qualifier as xs:string?]
) as map:map

Summary

This function matches and returns the uri, content, and score for documents.

Parameters
$query Qualifies a set of documents. The query can be a cts:query or as a sequence of document URI string literals.
$qualifier Specifies a name for qualifying the column names.

Usage Notes

The op:from-doc-uris function provides a convenience equivalent to the following:

declare function op:from-doc-uris(
    $query          as item()*,
    $qualifier      as xs:string?
) as map:map
{
    return op:from-lexicons(
              map:entry("uri", cts:uri-reference()),
              $qualifier,
              op:fragment-id-col("fragmentId")
            )
             =>op:where($query)
};
  

See Also

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-doc-uris(cts:word-query("tiger", ("case-sensitive")))
  =>op:result()
  

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $uriSeq := ('/test/fromDocUris/0.json',
                '/test/fromDocUris/1.json',
                '/test/fromDocUris/2.json')
return op:from-doc-uris($uriSeq)
=>op:result()
  

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $docColIdentifier := map:map()=>map:with("doc", "doc")
return op:from-doc-uris(cts:word-query('duck', ('case-sensitive')))
  =>op:join-doc-cols($docColIdentifier, op:col("uri"))
  =>op:order-by("uri")
  =>op:result()
  

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