sql:bucket( $bucketEdgesParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType, [$collationLiteral as xs:string] ) as xs:integer*
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.
for $i in (1,5,10) return sql:bucket((2,4,6,7,8), $i) => 0 2 5
sql:bucket(('Aขเ','Aเ', 'B'), 'Aเข', 'http://marklogic.com/collation/th') => 0
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.