From a1ba6f9a05a4fa0864c3460f08c207f75ce65647 Mon Sep 17 00:00:00 2001 From: Magdalena Turska Date: Thu, 18 Apr 2024 15:12:15 +0200 Subject: [PATCH] fix(index) allow for multiple values in hierarchical genre facet --- index.xql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.xql b/index.xql index 0cf8d8d0..f4c8dccb 100644 --- a/index.xql +++ b/index.xql @@ -85,10 +85,13 @@ declare function idx:get-metadata($root as element(), $field as xs:string) { }; declare function idx:get-genre($header as element()?) { - for $target in $header//tei:textClass/tei:catRef[@scheme="#genre"]/@target - let $category := id(substring($target, 2), doc($idx:app-root || "/data/taxonomy.xml")) + let $targets := $header//tei:textClass/tei:catRef[@scheme="#genre"]/@target return + array:for-each(array {$targets}, function($target) { + let $category := id(substring($target, 2), doc($idx:app-root || "/data/taxonomy.xml")) + return $category/ancestor-or-self::tei:category[parent::tei:category]/tei:catDesc + }) }; declare function idx:get-classification($header as element()?, $scheme as xs:string) {