Commit ae33a125 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

refined faceted search

parent ce355a01
......@@ -5,7 +5,11 @@
<param key="thumbnail">true</param>
<param key="hits-per-page">10</param>
<param key="query-root">
<!-- TODO: find out why config from /sade-projects/.../config.xml is not available anymore-->
<!-- TODO: find out why config from /sade-projects/.../config.xml is not available anymore
system uses project config. again.
-->
<!--xpath>//tei:TEI</xpath-->
<xpath>//tei:sourceDoc/tei:surface</xpath>
</param>
......@@ -13,18 +17,19 @@
<xpath>//tei:fileDesc//tei:titleStmt/tei:title/text()</xpath>
</param>
<param key="facets">
<facet key="plc" title="Ort">
<!-- <facet key="plc" title="Ort">
<xpath>tei:rs/@ref[starts-with(., 'plc')]</xpath>
</facet>
</facet>
<facet key="psn" title="Person">
<xpath>tei:rs/@ref[starts-with(., 'psn')]</xpath>
</facet>
<facet key="org" title="Organisation">
<xpath>tei:rs/@ref[starts-with(., 'org')]</xpath>
</facet>
</facet>
<facet key="wrk" title="Werk">
<xpath>tei:rs/@ref[starts-with(., 'wrk')]</xpath>
</facet>
</facet>
-->
</param>
</module><!-- added by faceted search -->
<container key="html-head">
......
......@@ -194,19 +194,17 @@ function fsearch:facet-title($node as node(), $model as map(*)) {
<li>{map:keys($model("facet"))}</li>
};
declare function fsearch:facet($node as node(), $model as map(*)) as item()* {
for $facet in $model("config")//module[@key="faceted-search"]//facet
(: hide facet-categories with less than one entry :)
return if (count($model("facets")(xs:string($facet/@key))) > 0) then
<li><strong>{xs:string($facet/@title)}</strong>
<ul class="hideMore">{local:deselected-for-key($model, xs:string($facet/@key))}{$model("facets")(xs:string($facet/@key))}</ul>
</li>
else
()
};
let $facets := $model("config")//module[@key="faceted-search"]//facet
for $facet in $facets
(: hide facet-categories with less than one entry :)
where (count($model("facets")(xs:string($facet/@key))) > 0)
return
<li><strong>{xs:string($facet/@title)}</strong>
<ul class="hideMore">{local:deselected-for-key($model, xs:string($facet/@key))}{$model("facets")(xs:string($facet/@key))}</ul>
</li>
};
declare function local:facet($model as map(*), $hits as node()*, $key as xs:string, $types as xs:string*) as node()* {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment