module namespace searchhlp = "http://www.architextus.com/xquery/library/how2_searchhlp"; declare namespace rest="http://exquery.org/ns/restxq"; declare %rest:path("/testsearch") %rest:GET %rest:query-param("keywords", "{$keywords}", '') updating function searchhlp:searchhelp($keywords as xs:string){ let $options := map {"mode" := "all"} let $search-result := ft:search('en-us', tokenize(normalize-space($keywords), ' '), $options) let $result :=
{ for $x in $search-result (: Return only results if they are in the menu after filters are applied to get only content relevant to this user profile :) return

False title

}
let $html :=
A form...
{$result}
(: When function is not updating, replace return with following line. Result works in browser :) (: return $html :) return (searchhlp:analyze-user-search-and-result(), db:output($html)) }; declare updating function searchhlp:analyze-user-search-and-result(){ let $nothing := nothing return db:replace('feedback', 'stub.xml', document{$nothing} ) };