MarkLogic 12 Product Documentation
op:dimension

op:dimension(
   $column-builder-plan as map:map,
   $dimension as xs:unsignedInt
) as map:map

Summary

Sets the vector dimension for the column created by op:add-column. It only applies when the column's type is set to "vector". If the vector to be extracted does not have the same dimension, the value will be rejected. There's no default dimension. Vectors of all dimensions are extracted.

Parameters
$column-builder-plan The Column Builder Plan. You can either use the XQuery => chaining operator or specify the variable that captures the return value from the previous operation.
$dimension The vector dimension for the column created.

Example

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

op:from-docs(
  cts:collection-query("fromDocsColl"),
  "/my:root",
  op:column-builder()
   =>op:add-column("id")=>op:nullable(fn:true())=>op:type("integer")=>op:default(-1)
   =>op:add-column("name")=>op:expr(op:xpath(op:context(),"my2:name"))=>op:collation("http://marklogic.com/collation/codepoint")
   =>op:add-column("testXpath")=>op:xpath("./my2:name" )
   =>op:add-column("node")=>op:type("node")=>op:xpath(".")
   =>op:add-column("vector")=>op:xpath("./my2:vector")=>op:type("vector")=>op:dimension(3)
   =>op:add-column("geo")=>op:type("point")=>op:xpath("./my2:geo" )=>op:coordinate-system("wgs84/double")=>op:units("miles"),
  "TEST",
  op:fragment-id-col("myFragmentIdCol"),
  map:entry("my","https://www.example.com/my")=>map:with("my2","https://www.example.com/my2")
  )
=>op:select(("id","name","testXpath","node","vector","geo","myFragmentIdCol"))
=>op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy