Skip to content

Instantly share code, notes, and snippets.

@crichey
Created October 11, 2010 21:13
Show Gist options
  • Save crichey/621246 to your computer and use it in GitHub Desktop.
Save crichey/621246 to your computer and use it in GitHub Desktop.
declare function app:cluster() as element(li)*
{
if ($config:RESPONSE/search:result) then
let $docs :=
for $uri in $config:RESPONSE/search:result/@uri
return fn:doc($uri)
let $cluster-nodes := cts:cluster($docs,
<options xmlns="cts:cluster">
<algorithm>lsi</algorithm>
</options>)
for $cluster in $cluster-nodes/cts:cluster
return <li><a href="#">{xs:string($cluster/@label)}&nbsp;({xs:string($cluster/@count)})</a></li>
else <li></li>
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment