You can use QueryOptionsManager.writeOptions()
to persist query options that define a values lookup for the collection lexicon:
<options xmlns="http://marklogic.com/appservices/search">
<values name="collections">
<collection/>
</values>
</options>
Then use a QueryManager.values()
request to get the collections.
For more detail, see:
http://docs.marklogic.com/guide/java/query-options#id_83483
http://docs.marklogic.com/javadoc/client/com/marklogic/client/admin/QueryOptionsManager.html
http://docs.marklogic.com/guide/java/searches#id_83836
http://docs.marklogic.com/javadoc/client/com/marklogic/client/query/QueryManager.html#values-com.marklogic.client.query.ValuesDefinition-T-
As an alternative, for more flexibility and control, you can install a JavaScript or XQuery resource service extension or main module on the server and call the resource service extension or invoke the module.
You can use eval() to iterate quickly while developing the server side code. The only caveat is that eval() is discouraged in production because of the security concerns (especially when the operations require that the user have elevated privileges).
Hoping that's useful,
"*"
argument. It is probably not doing what you expect. Usects:collection-match
if you want to filter collection names using a pattern. – grtjn