You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2006/10/20 11:07:37 UTC
[Solr Wiki] Update of "XsltResponseWriter" by BertrandDelacretaz
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by BertrandDelacretaz:
http://wiki.apache.org/solr/XsltResponseWriter
The comment on the change is:
Page created
New page:
[[TableOfContents]]
= Overview =
The [http://incubator.apache.org/solr/docs/api/org/apache/solr/request/XSLTResponseWriter.html XSLT Response Writer] captures the output of the [XMLResponseFormat XML Response Writer] and applies an XSLT transform to it.
This can be used to generate any text-based format from the Solr query results, as the Content-Type of the response is supplied by the XSLT transform, as shown below.
= Example =
With Solr's example configuration, this URL uses the XSLT Response Writer with the supplied example.xsl transform:
{{{http://localhost:8983/solr/select/?stylesheet=&q=apache&wt=xslt&tr=example.xsl}}}
= Parameters =
The behavior of the XSLT Response Writer can be driven by the following query paramaters.
== tr ==
The XSLT transformation to use, which must be found in Solr's conf/xslt directory.
The Content-Type of the response is set according to the <xsl:output> statement in the XSLT transform, for example:
{{{<xsl:output media-type="text/html"/>}}}
= Configuration =
The XSLT Response Writer is configured as in this example (from the default solrconfig.xml):
{{{
<!--
Changes to XSLT transforms are taken into account
every xsltCacheLifetimeSeconds at most.
-->
<queryResponseWriter
name="xslt"
class="org.apache.solr.request.XSLTResponseWriter"
>
<int name="xsltCacheLifetimeSeconds">5</int>
</queryResponseWriter>
}}}
= Performance =
The last XSLT transform used is cached, and reread and recompiled every xsltCacheLifetimeSeconds, even if it has not changed. This simplistic caching mechanism is good enough in many cases, but heavy use of XSLT transforms might require implementing a better caching mechanism (or -shameless plug- put [http://cocoon.apache.org/ Cocoon] in front of Solr for more serious stuff).
The performance of XSLT transforms can vary dramatically depending on how well they're written - you've been warned.