diff --git a/xq/abv-mod.xqm b/xq/abv-mod.xqm
index 79eb447..41516b8 100644
--- a/xq/abv-mod.xqm
+++ b/xq/abv-mod.xqm
@@ -269,11 +269,13 @@ declare function abv-m:entry-form-by-id($id as xs:string) {
doc(`abaevdict_index/lookup.xml`)/tei:table[1]/tei:entry[@xml:id=$id]/text()
};
-declare function abv-m:mark-element($doc as document-node(), $path as xs:string) {
+declare function abv-m:mark-element($doc as document-node(),
+ $path as xs:string,
+ $query as xs:string) {
let $doc-tr := $doc transform with {
for $n in xquery:eval($path, {'': .})
return replace node $n
- with {$n}
+ with ft:mark($n[. contains text {$query}])
}
return $doc-tr
};
diff --git a/xq/restx_dict_cached.xq b/xq/restx_dict_cached.xq
index fb49720..dad7ef0 100644
--- a/xq/restx_dict_cached.xq
+++ b/xq/restx_dict_cached.xq
@@ -221,7 +221,6 @@ declare %rest:path("{$lang}/search/prev")
let $n as xs:integer := session:get('searchN')-1
let $r1 := session:set('searchN', $n)
let $sd := session:get('searchData')
- let $node := db:get-id(`abaevdict_{$lang}`,$sd[$n])
return page:by-id($lang, $sd($n)('entry'), string-join($sd($n)('nodes'),'|'))
};
@@ -232,7 +231,6 @@ declare %rest:path("{$lang}/search/position")
function page:search-position($lang, $p as xs:integer) {
let $r1 := session:set('searchN', $p)
let $sd := session:get('searchData')
- let $node := db:get-id(`abaevdict_{$lang}`,$sd[$p])
return page:by-id($lang, $sd($p)('entry'), string-join($sd($p)('nodes'),'|'))
};
@@ -519,7 +517,9 @@ declare %rest:path("{$lang}/dict")
{for $doc at $i in $page:sorted
where $i > ($p - 1) * $page:items and $i <= $p * $page:items
let $html := if ($xpath != '' and $entry = $doc/@xml:id)
- then abv-m:mark-element(doc(`abaevdict_{$lang}/xml/{$doc/@xml:id}.xml`),$xpath) => abv-m:make-html($lang)
+ then abv-m:mark-element(
+ doc(`abaevdict_{$lang}/xml/{$doc/@xml:id}.xml`),
+ $xpath, session:get('searchQuery')) => abv-m:make-html($lang)
else doc(`abaevdict_{$lang}/html/{$doc/@xml:id}.html`)
return (
(: Block with icons to the left of entry (floating) :)
diff --git a/xsl/abaev2html.xsl b/xsl/abaev2html.xsl
index 1104a5e..974864e 100644
--- a/xsl/abaev2html.xsl
+++ b/xsl/abaev2html.xsl
@@ -1,5 +1,6 @@
-
-
+