MarkLogic 12 EA 1 Product Documentation
vec.subvector

vec.subvector(
   vector as vec.vector,
   start as Number,
   [length as Number?]
) as vec.vector

Summary

Returns a subvector of the input vector, starting at the specified index, with the specified length (optional).

Parameters
vector The input vector.
start The zero-based index of the input vector from which to start (inclusive).
length The length of the subvector. If not provided, returns a subvector beginning from index at start to the end of the input vector. If length is greater than the number of elements left in the input vector, throw VEC-OUTOFBOUNDS.

Example

const vector = vec.vector([3.14,1.59,2.65,3.58,9.79,3.23])
  vec.subvector(vector, 2, 3)

  => "[ 2.65, 3.58, 9.79 ]"
Powered by MarkLogic Server | Terms of Use | Privacy Policy