Book Image

Apache Solr Enterprise Search Server - Third Edition

By : David Smiley, Eric Pugh, Kranti Parisa, Matt Mitchell
Book Image

Apache Solr Enterprise Search Server - Third Edition

By: David Smiley, Eric Pugh, Kranti Parisa, Matt Mitchell

Overview of this book

<p>Solr Apache is a widely popular open source enterprise search server that delivers powerful search and faceted navigation features—features that are elusive with databases. Solr supports complex search criteria, faceting, result highlighting, query-completion, query spell-checking, relevancy tuning, geospatial searches, and much more.</p> <p>This book is a comprehensive resource for just about everything Solr has to offer, and it will take you from first exposure to development and deployment in no time. Even if you wish to use Solr 5, you should find the information to be just as applicable due to Solr's high regard for backward compatibility. The book includes some useful information specific to Solr 5.</p>
Table of Contents (19 chapters)
Apache Solr Enterprise Search Server Third Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using XSLT to transform XML search results


A relatively unknown, but powerful way to integrate with Solr is via its support for XSLT (eXtensible Stylesheet Language Transformations). XSLT is a specification for transforming XML documents into other XML formats, which includes HTML. There are various implementations of this specification and Java includes one. Solr provides a query response writer that executes a provided XSLT stylesheet to transform Solr's XML search results into some other format. Solr comes with a couple of examples in ./conf/xslt/. Here is an example of transforming search results into an RSS feed:

http://localhost:8983/solr/mbartists/select/?q=marley&wt=xslt&tr=example_rss.xsl

The wt parameter triggers the use of XSLT, and the tr parameter supplies the name of the stylesheet to be used.

There are some caveats to keep in mind for XSLT support. Internally, XSLT files are compiled before they are used, and while Solr will cache the last compiled XSLT for a period...