sql.bucket( bucketEdgesParam as (String | Number | Boolean | null | Array | Object)[], srchParam as xs.anyAtomicType, [collationLiteral as String] ) as Sequence
Returns an unsignedLong specifying the index of the bucket the second parameter belongs to in buckets formed by the first parameter. Values that lie on the edge of a bucket fall to the greater index.
const arr = xdmp.arrayValues(['Aaron', 'John', 'Jos']) sql.bucket(arr, 'John') => 2
sql.bucket(xdmp.arrayValues(['Aá','Añ', 'B']), 'Aé', 'http://marklogic.com/collation/es'); => 1
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.