Skip to content

Instantly share code, notes, and snippets.

@dscape
Created March 23, 2011 14:29
Show Gist options
  • Save dscape/883178 to your computer and use it in GitHub Desktop.
Save dscape/883178 to your computer and use it in GitHub Desktop.
Sample Co-occurence Index
for $c in cts:element-value-co-occurrences(
fn:QName("http://marklogic.com/MLU/top-songs", "genre"),
fn:QName("http://marklogic.com/MLU/top-songs", "artist")
, ("frequency-order",
"collation-1=http://marklogic.com/collation/en/S1/AS/T00BB",
"collation-2=http://marklogic.com/collation/en/S1/AS/T00BB"), cts:and-query(()))
return <i c="{cts:frequency($c)}">{
for $v in $c
return (attribute fst {fn:string($v//*:value[1])},
attribute snd {fn:string($v//*:value[2])})}</i>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment