@@ -21,7 +21,7 @@ declare variable $dq:CHARS_KWIC := 80;
2121(:~
2222 Templating function: process the query.
2323:)
24- declare
24+ declare
2525 %public
2626 %templates:default("field" , "all" )
2727 %templates:default("view" , "summary" )
@@ -46,7 +46,7 @@ function dq:query($node as node()*, $model as map(*), $q as xs:string?, $field a
4646: @param field the name of a field, if the query should be restricted to a specific field
4747:
4848: @return The elements that match the query, typically one of:
49- : db5:title, db5:keyword, db5:para, db5:sect1, db5:sect2, db5:sect3.
49+ : db5:title, db5:keyword, db5:para, db5:sect1, db5:sect2, db5:sect3.
5050:)
5151declare
5252 %public
@@ -56,7 +56,7 @@ function dq:do-query($context as node()*, $query as xs:string?, $field as xs:str
5656 $context/db5:article/db5:info/db5:title[ft:query (., $query)]
5757 |
5858 $context//(db5:sect3|db5:sect2|db5:sect1)/db5:title[ft:query (., $query)]
59-
59+
6060 default return
6161 $context//db5:keyword[ft:query (., $query)]
6262 |
@@ -142,11 +142,11 @@ function dq:print($hit as element(), $search-params as map(xs:string, xs:string)
142142 <config xmlns = "" width = "{if ($view eq 'summary' ) then $dq:CHARS_SUMMARY else $dq:CHARS_KWIC} "
143143 table = "{if ($view eq 'summary' ) then 'no' else 'yes' } "
144144 link = "{$uri} " />
145-
145+
146146 for $ancestor in ($matches/ancestor::db5:para | $matches/ancestor::db5:title | $matches/ancestor::db5:td | $matches/ancestor::db5:note[not (db5:para)])
147147 for $match in $ancestor//exist:match
148148 return
149- kwic:get-summary ($ancestor, $match, $config)
149+ kwic:get-summary ($ancestor, $match, $config)
150150 else
151151 let $ancestors := ($matches/ancestor::db5:para | $matches/ancestor::db5:title | $matches/ancestor::db5:td | $matches/ancestor::db5:note[not (db5:para)])
152152 return
@@ -175,8 +175,11 @@ function dq:match-to-copy($element as element()) as element() {
175175declare
176176 %private
177177function dq:to-uri-query ($search-params as map (xs:string, xs:string)) as xs:string {
178+ let $string :=
178179 string-join (
179180 map:for-each ($search-params, function ($k, $v) { $k || "=" || $v }),
180181 "& "
181182 )
182- };
183+ return
184+ substring-after ($string, 'q=xsl& ' )
185+ };
0 commit comments