Skip to content

Commit de7cbff

Browse files
authored
Merge pull request majlis-erc#794 from evolvedbinary/hotfix/get-rec-performance
Fix the performance of get-rec.xql
2 parents c368195 + 3b70f63 commit de7cbff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/xar-resources/services/get-rec.xql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ declare function local:passthru($node as node()*) as item()* {
122122

123123
declare function local:get-label($ref as xs:string) as xs:string {
124124
let $collection := "/db/apps/majlis-data/data"
125-
let $doc := (collection($collection)//tei:idno[@type eq "URI"][. = ($ref, concat($ref, "/"), concat($ref, "/tei"))]/ancestor::tei:TEI)[1]
125+
let $expanded-refs := ($ref, concat($ref, "/"), concat($ref, "/tei"))
126+
let $doc := head(collection($collection)//tei:idno[@type eq "URI"][. = $expanded-refs]/ancestor::tei:TEI)
126127
let $label := $doc/descendant::tei:title[1]/descendant-or-self::text()
127128
return
128129
normalize-space($label)

0 commit comments

Comments
 (0)