improved search highlight and fix search

This commit is contained in:
Oleg Belyaev 2025-03-24 16:23:32 +03:00
parent 3855cf6bf0
commit 10b0f39199
3 changed files with 10 additions and 7 deletions

View file

@ -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 <abv:mark>{$n}</abv:mark>
with ft:mark($n[. contains text {$query}])
}
return $doc-tr
};