Created
January 7, 2014 17:39
-
-
Save eedeebee/8303191 to your computer and use it in GitHub Desktop.
Grouping the values from a range index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace sample = "http://marklogic.com/sample"; | |
let $groupsize := 1000 | |
let $values := cts:element-values(xs:QName("sample:value")) | |
let $count := fn:count($values) | |
let $groups := | |
for $i in (0 to (xs:int($count div $groupsize) + 1)) | |
let $group := $values[(($i * $groupsize) + 1) to (($i + 1) * $groupsize)] | |
return fn:string-join($group, "|") | |
return (fn:count($groups), $groups) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment