Skip to content

Commit

Permalink
MIR-1251 add support for arbitrary classification facets w/o the need…
Browse files Browse the repository at this point in the history
… for specialized SOLR fields
  • Loading branch information
toKrause authored and kkrebs committed Nov 15, 2023
1 parent 55e17ec commit ad4d2f7
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions mir-module/src/main/resources/xsl/response-mir.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -919,11 +919,31 @@
<xsl:template match="/response/lst[@name='facet_counts']/lst[@name='facet_fields']">
<xsl:param name="facet_name" />
<xsl:param name="classId" />
<xsl:param name="categoryClassValues" select="false()"/>
<xsl:param name="i18nPrefix" />
<xsl:for-each select="lst[@name=$facet_name]/int">
<xsl:variable name="fqValue" select="concat($facet_name,':',@name)"/>
<xsl:variable name="fqValue" >
<xsl:choose>
<xsl:when test="$categoryClassValues">
<xsl:value-of select="concat($classId,':',substring-before(@name,':'),'%5C:',substring-after(@name,':'))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($classId,':',@name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="fqResponseValue" >
<xsl:choose>
<xsl:when test="$categoryClassValues">
<xsl:value-of select="concat($classId,':',substring-before(@name,':'),'\:',substring-after(@name,':'))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($classId,':',@name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="fqFragment" select="concat('fq=',$fqValue)" />
<xsl:variable name="fqFragmentEncoded" select="concat('fq=',encoder:encode($fqValue, 'UTF-8'))" />
<xsl:variable name="fqFragmentEncoded" select="concat('fq=',encoder:encode($fqResponseValue, 'UTF-8'))" />
<xsl:variable name="queryWithoutStart" select="mcrxsl:regexp($RequestURL, '(&amp;|%26)(start=)[0-9]*', '')" />
<xsl:variable name="queryURL">
<xsl:choose>
Expand Down Expand Up @@ -958,18 +978,21 @@
</xsl:choose>
</xsl:variable>

<li data-fq="{$fqValue}">
<li data-fq="{$fqResponseValue}">
<div class="custom-control custom-checkbox" onclick="location.href='{$queryURL}';">
<input type="checkbox" class="custom-control-input">
<xsl:if test="
/response/lst[@name='responseHeader']/lst[@name='params']/str[@name='fq' and text() = $fqValue] |
/response/lst[@name='responseHeader']/lst[@name='params']/arr[@name='fq']/str[text() = $fqValue]">
<xsl:attribute name="checked">true</xsl:attribute>
</xsl:if>
</input>
<input type="checkbox" class="custom-control-input">
<xsl:if test="
/response/lst[@name='responseHeader']/lst[@name='params']/str[@name='fq' and text() = $fqResponseValue] |
/response/lst[@name='responseHeader']/lst[@name='params']/arr[@name='fq']/str[text() = $fqResponseValue]">
<xsl:attribute name="checked">true</xsl:attribute>
</xsl:if>
</input>
<label class="custom-control-label">
<span class="title">
<xsl:choose>
<xsl:when test="$categoryClassValues">
<xsl:value-of select="mcrxsl:getDisplayName(substring-before(@name,':'),substring-after(@name,':'))" />
</xsl:when>
<xsl:when test="string-length($classId) &gt; 0">
<xsl:value-of select="mcrxsl:getDisplayName($classId, @name)" />
</xsl:when>
Expand Down

0 comments on commit ad4d2f7

Please sign in to comment.