MarkLogic 12 Product Documentation
ColumnBuilderPlan.prototype.dimension

ColumnBuilderPlan.prototype.dimension(
   dimension as Number
) as ColumnBuilderPlan

Summary

Sets the vector dimension for the column created by ColumnBuilderPlan.prototype.addColumn . 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
dimension The vector dimension for the column created.

Example

const op = require('/MarkLogic/optic');

op.fromDocs(
  cts.collectionQuery("fromDocsJson"),
  "/",
  op.columnBuilder()
   .addColumn("id").nullable(true).type("integer").default(-1)
   .addColumn("name").collation("http://marklogic.com/collation/codepoint")
   .addColumn("node").type("node").xpath(".")
   .addColumn("expr").type("unsignedLong").expr(op.xdmp.random())
   .addColumn("vector").type("vector").dimension(3)
   .addColumn("geoData").xpath("geo").type("point").coordinateSystem("wgs84/double").units("miles"),
 "myView", "myFragmentId"
)
.orderBy("id")
.select(["id","name","node","expr","vector","geoData","myFragmentId"])
.result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy