Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SADE
SADE
Commits
ae33a125
Commit
ae33a125
authored
May 03, 2017
by
Mathias Goebel
Browse files
refined faceted search
parent
ce355a01
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/modules/faceted-search/config.xml
View file @
ae33a125
...
...
@@ -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"
>
...
...
src/modules/faceted-search/faceted-search.xqm
View file @
ae33a125
...
...
@@ -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()* {
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment