Skip to content

Instantly share code, notes, and snippets.

@wsalesky
Created June 18, 2014 18:04
Show Gist options
  • Save wsalesky/843277c72b0c24b1b418 to your computer and use it in GitHub Desktop.
Save wsalesky/843277c72b0c24b1b418 to your computer and use it in GitHub Desktop.
Super simple search function
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