searchDocByTitle.hq 548 Bytes
Newer Older
1
(: This script will return documents by searching one keyword in their title :)
simei.yin's avatar
simei.yin committed
2 3 4 5
(: We can assign a Regular Expression to the variable $name :)
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)

6 7 8
declare function local:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
  for $doc in $docs
9 10
  where matches($doc/titre, $name, "i")
  return $doc
11 12 13 14
};

(: Example :)
local:searchDocByTitle('^NF29_HdocEtherpad$', //document)