Skip to content

Commit

Permalink
MIR-1241: remove variables $MIR.Response.Facet.Prefix.Classification,…
Browse files Browse the repository at this point in the history
… $classId
  • Loading branch information
Oleksiy 'Alex' Levshyn authored and Possommi committed Nov 17, 2023
1 parent e136760 commit 6521cda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 0 additions & 2 deletions mir-module/src/main/resources/config/mir/mycore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ MCR.Solr.Proxy.WhiteList=%MCR.Solr.Proxy.WhiteList%,/find,/mods_name,/mods_nameI
MCR.Solr.HTTPResponseHeader.Content-Security-Policy=
# MIR still works with dynamic generated solr fields
MCR.Solr.DynamicFields=true
# specify a prefix for the classification facet
MIR.Response.Facet.Prefix.Classification=

##############################################################################
# URIResolver & ContentTransformer #
Expand Down
19 changes: 3 additions & 16 deletions mir-module/src/main/resources/xsl/response-facets.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,14 @@
xmlns:fn="http://www.w3.org/2005/xpath-functions"
exclude-result-prefixes="i18n mcrxsl encoder xalan fn">

<xsl:param name="MIR.Response.Facet.Prefix.Classification"/>

<xsl:template name="facets">

<xsl:for-each select="/response/lst[@name='facet_counts']/lst[@name='facet_fields']/*">
<xsl:variable name="facet_name" select="self::node()/@name"/>
<xsl:variable name="classId">
<!-- Check if facet has a prefix -->
<xsl:choose>
<xsl:when test="contains($facet_name, $MIR.Response.Facet.Prefix.Classification)">
<xsl:value-of select="substring-after($facet_name, $MIR.Response.Facet.Prefix.Classification)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$facet_name" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<!-- Get the classification named $classId -->
<!-- Get the classification named $facet_name -->
<xsl:variable name="classification">
<xsl:value-of select="concat('notnull:classification:metadata:all:children:',$classId)"/>
<xsl:value-of select="concat('notnull:classification:metadata:all:children:',$facet_name)"/>
</xsl:variable>

<!-- TODO: remove conditions for facets 'worldReadableComplete' and 'mods.genre' after code refactoring -->
Expand Down Expand Up @@ -110,7 +97,7 @@
<xsl:apply-templates
select="/response/lst[@name='facet_counts']/lst[@name='facet_fields']">
<xsl:with-param name="facet_name" select="$facet_name"/>
<xsl:with-param name="classId" select="$classId"/>
<xsl:with-param name="classId" select="$facet_name"/>
<xsl:with-param name="classification" select="$classification"/>
</xsl:apply-templates>
</xsl:otherwise>
Expand Down

0 comments on commit 6521cda

Please sign in to comment.