MarkLogic 12 EA 1 Product Documentation
sql.bucketsql.bucket(
bucketEdgesParam as (String | Number | Boolean | null | Array | Object)[],
srchParam as xs.anyAtomicType,
[collationLiteral as String]
) as Sequence
Summary
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.
Parameters |
bucketEdgesParam |
A sequence of ordered values indicating the edges of a collection of buckets. If the sequence is out of order or
has duplicates, SQL-UNORDERED is thrown.
|
srchParam |
A value to find an index for in the bucket edge list.
|
collationLiteral |
A collation identifier. All bucketEdgesParam and srcParam are converted
to a string of this collation if supplied.
|
Example
const arr = xdmp.arrayValues(['Aaron', 'John', 'Jos'])
sql.bucket(arr, 'John')
=>
2
Example
sql.bucket(xdmp.arrayValues(['Aá','Añ', 'B']), 'Aé', 'http://marklogic.com/collation/es');
=>
1
Copyright © 2024 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.