title: MarkLogic Search return document collections
body: <p>Is there a way to <strong>return the collections</strong> of a document if you are using the <strong>search api</strong>?</p>
  
  <p>I could not find a option in the <a href="http://docs.marklogic.com/guide/search-dev/appendixa#chapter" rel="nofollow noreferrer">Query Options Reference</a> for that use case.</p>
  
  <p>Right now i would have to build my own wrapper around the search api and find the collections of search results by myself:</p>
  
  <pre><code>xquery version "1.0-ml";
  import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
  
  let $docs := search:search("query")
  
  return for $doc in $docs
  return xdmp:node-collections(doc($doc/search:result/@uri))
  </code></pre>
  
  <p>Edit: This should be also availiable with the marklogic java client api.</p>