Skip to content

Instantly share code, notes, and snippets.

@ryanjdew
Created June 8, 2012 13:15
Show Gist options
  • Select an option

  • Save ryanjdew/2895553 to your computer and use it in GitHub Desktop.

Select an option

Save ryanjdew/2895553 to your computer and use it in GitHub Desktop.
Example cts:word-query with synonym option
element results {
for $i in cts:search(/content,
cts:word-query(('Jesus Christ','Christ','Messiah','Savior','Redeemer','Lord'),('case-sensitive','synonym'))
)
[1 to 10]/(element title { attribute score {cts:score(.)}, string(title)})
order by $i/@score descending, $i ascending
return $i
}
(: =>
<results>
<title score="37120">Special Witnesses of Christ</title>
<title score="34048">“Another Testament of Jesus Christ”</title>
<title score="34048">“The Light and Life of the World”</title>
<title score="34048">Chapter 3: Jesus Christ: My Savior, My Lord</title>
<title score="34048">He Lives! The Witness of Latter-day Prophets</title>
<title score="34048">New Testament: Student Study guide</title>
<title score="34048">The Book of Moses</title>
<title score="34048">The Establishment of Zion (Isaiah 1–12)</title>
<title score="34048">Unique Insights on Christ from the Book of Mormon</title>
<title score="30976">“What Think Ye of Christ?” “Whom Say Ye That I Am?”</title>
</results>
:)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment