HackingSolr

Solr Plugins

The first thing to know if you are interested in hacking and customizing Solr, is that you may not need to customize the source at all. Solr has a fairly extensive number of Plugin Hooks that allow you to add custom functionality for a variety of purposes by developing against some simple APIs, and then use your plugins by placing your jar in a special "lib" directory and refering to them by name in your configuration file.

web.xml Hacks

Some behavior of Solr can be modified just by changing the [WWW] web.xml

Customizing the Path Prefix Solr Intercepts

If you are wiring Solr into a larger web application which controls the web context root, you will probably want to mount Solr under a path prefix (app.war with /app/solr mounted into it, for example). You will need to specify a prefix init-param for the SolrDispatchFilter to do this. See the comments in the web.xml for details.

Hardcoding Solr Home

The Solr Home can be hardcoded using JNDI

 <env-entry>
    <env-entry-name>solr/home</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>/put/your/solr/home/here</env-entry-value>
</env-entry>

Embedding Solr

In addition to using Solr as a web based application, the SolrJ API provides the apility to embedded the core Solr functionality into any Java application using EmbeddedSolrServer.

last edited 2008-06-01 17:57:59 by HossMan