@@ -107,15 +107,15 @@ declare function local:findAnnotations($edition as xs:string, $uri as xs:string,
107
107
108
108
(: TODO: search in other documents and in other collections :)
109
109
(: TODO: check if annotations hold URIs or IDRefs :)
110
- functx:distinct-deep (
110
+ let $annots := collection (eutil:getPreference ('edition_path' , $edition))//mei:annot
111
+ let $ret :=
111
112
for $id in $elemIds
112
113
113
114
let $uriPlusId := concat ($uri, '#' , $id)
114
115
115
116
let $hashId := '#' || $id
116
117
117
118
(: all mei:annot elements in the editions 'edition_path' collection :)
118
- let $annots := collection (eutil:getPreference ('edition_path' , $edition))//mei:annot
119
119
120
120
return
121
121
(:
@@ -124,7 +124,7 @@ declare function local:findAnnotations($edition as xs:string, $uri as xs:string,
124
124
:)
125
125
$annots[contains (@plist, $uriPlusId)][$uriPlusId = tokenize (@plist, '\s' )] |
126
126
$annots[contains (@plist, $hashId)][$hashId = tokenize (@plist, '\s' )]
127
- )
127
+ return functx:distinct-deep ($ret )
128
128
};
129
129
130
130
(:~
@@ -232,7 +232,11 @@ let $measureLike :=
232
232
for $id in $zones[@type = 'measure' or @type = 'staff' ]/string (@xml:id)
233
233
let $ref := concat ('#' , $id)
234
234
return
235
- $mei//*[$ref = tokenize (@facs, '\s' )]
235
+ (:
236
+ : The first predicate with `contains` is just a rough estimate to narrow down the result set.
237
+ : It uses the index and is fast while the second (exact) predicate is generally too slow
238
+ :)
239
+ $mei//*[contains (@facs, $ref)][$ref = tokenize (@facs, '\s+' )]
236
240
237
241
let $svgLike := $surface//svg:svg
238
242
0 commit comments