I have been working with a SolrJ-based Java client that builds/sends queries to an external Solr instance and processes their responses back to a web application. I have an XSLT named response.xslt where all necessary mappings between the local Solr schema and the UI are specified. In my case, I have been trying to build and display facets according to the SOLR response below:
<facets>
<facet name="domain">
<facetEntry count="10">blogspot.co.uk</facetEntry>
<facetEntry count="6">indys.org.uk</facetEntry>
<facetEntry count="3">royalcanin.co.uk</facetEntry>
<facetEntry count="1">faerie-tales.co.uk</facetEntry>
<facetEntry count="1">polishbeautyclinic.co.uk</facetEntry>
<facetEntry count="1">shua.org.uk</facetEntry>
<facetEntry count="1">sunnyharbour.org.uk</facetEntry>
</facet>
</facets>
The XML as returned by my web application looks like this:
<sear:FACET NAME="local36" COUNT="20">
<sear:FACET_VALUES KEY="blogspot.co.uk" VALUE="10"/>
<sear:FACET_VALUES KEY="indys.org.uk" VALUE="6"/>
<sear:FACET_VALUES KEY="royalcanin.co.uk" VALUE="3"/>
<sear:FACET_VALUES KEY="faerie-tales.co.uk" VALUE="1"/>
<sear:FACET_VALUES KEY="polishbeautyclinic.co.uk" VALUE="1"/>
<sear:FACET_VALUES KEY="shua.org.uk" VALUE="1"/>
<sear:FACET_VALUES KEY="sunnyharbour.org.uk" VALUE="1"/>
</sear:FACET>
Nevertheless, the final facets structure from the UI is wrongly generated. In a nutshell, it only displays the last value "sunnyharbour.org.uk" multiple times. My first thought was that, for some reasons, the full stops/periods in the URLs trigger such UI behaviour, so I harcoded the response as follows:
<sear:FACET NAME="local36" COUNT="20">
<sear:FACET_VALUES KEY="blogspot" VALUE="10"/>
<sear:FACET_VALUES KEY="indys" VALUE="6"/>
<sear:FACET_VALUES KEY="royalcanin" VALUE="3"/>
<sear:FACET_VALUES KEY="faerie-tales" VALUE="1"/>
<sear:FACET_VALUES KEY="polishbeautyclinic" VALUE="1"/>
<sear:FACET_VALUES KEY="shua" VALUE="1"/>
<sear:FACET_VALUES KEY="sunnyharbour" VALUE="1"/>
</sear:FACET>
In this way, the facets are generated as expected.
My response file looks like this:
<xsl:template match="facets">
<xsl:apply-templates select="facet" />
</xsl:template>
<xsl:template match="facet">
</xsl:template>
<xsl:template match="facet[@name='domain']">
<sear:FACET NAME="local36" COUNT="{count(facetEntry)}">
<xsl:apply-templates select="facetEntry" />
</sear:FACET>
<xsl:template match="facetEntry">
<sear:FACET_VALUES VALUE="{@count}" KEY="{.}" />
</xsl:template>
I am not sure what it would be the best course of action, but in principle I would like to be able to encode periods in URLs. Can you help me with this?
Thanks,
I.