Last active
July 11, 2017 16:34
-
-
Save joewiz/4885943ac9a196596be6a1e1416e7f58 to your computer and use it in GitHub Desktop.
Get distinct values, using range indexes in eXist-db
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 "3.1"; | |
(: In eXist-db, distinct-values() is not backed by range indexes. | |
To achieve better performance for this operation, use util:index-keys. | |
This sample retrieves all distinct indexed values for the @ref attribute. :) | |
util:index-keys(collection("/db/apps/my-app/data")//@ref, (), | |
function($key, $count) { | |
$key | |
}, -1, "range-index") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment