Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

reversing sense of facet-value @name and lexical #67

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/app/views/helpers/facet-lib.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ declare function facet:facets(
let $list-items :=
for $result in $facet/search:facet-value
let $facet-val :=
if (fn:matches($result/@name/fn:string(), "\W")) then
fn:concat('"', $result/@name/fn:string(), '"')
else if ($result/@name eq "") then """"
else $result/@name/fn:string()
(: This is not robust because the user can change the grammar. :)
if (fn:matches($result, "[^\w\d\.]")) then
fn:concat('"', $result, '"')
else if ($result eq "") then """"
else $result/fn:string()
let $fq := fn:concat($facet-name, ":", $facet-val)
let $newquery :=
if ($qtext) then
Expand All @@ -66,7 +67,7 @@ declare function facet:facets(
else fn:concat("(", $qtext, ")", " AND ", $fq)
else $fq
let $href := fn:concat("/?q=",fn:encode-for-uri($newquery))
let $title := (trans:translate($result/fn:string(), $labels, (), "en"), $result/fn:string())[1]
let $title := (trans:translate($result/@name, $labels, (), "en"), $result/fn:string())[1]
return
<li>
<a href="{$href}">{if ($title eq "") then <em>(empty)</em> else $title}</a><i> ({$result/@count/fn:string()})</i>
Expand Down