Created
June 18, 2014 18:04
-
-
Save wsalesky/843277c72b0c24b1b418 to your computer and use it in GitHub Desktop.
Super simple search function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
module namespace search ="http://xqueryinstitute.org/search"; | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
(: | |
: Limit results/pagination | |
: Total hit count | |
: | |
: :) | |
declare function search:search($term as xs:string?, $rows as xs:integer) as element()* { | |
let $hits := collection('/db/apps/xq-institute/data/indexed-plays')//tei:sp[ft:query(.,$term)] | |
for $page in subsequence($hits,1,$rows) | |
return $page | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment