Last Updated: February 25, 2016
·
1.52K
· klclee

Apache solr contrib and dist path

When you have solr deployed in tomcat the contrib/dist paths in solrconfig.xml get all messed up.

Set JAVA_OPTS with an extra param:

-Dsolr.exlib.dir=<location to contrib> 

Then in solrconfig.xml do this:
<lib dir="${solr.exlib.dir:}/contrib/extraction/lib" regex="..jar" />
<lib dir="${solr.exlib.dir:}/dist/" regex="solr-cell-\d.
.jar" />

<lib dir="${solr.exlib.dir:}/contrib/clustering/lib/" regex=".*\.jar" />
<lib dir="${solr.exlib.dir:}/dist/" regex="solr-clustering-\d.*\.jar" />

<lib dir="${solr.exlib.dir:}/contrib/langid/lib/" regex=".*\.jar" />
<lib dir="${solr.exlib.dir:}/dist/" regex="solr-langid-\d.*\.jar" />

<lib dir="${solr.exlib.dir:}/contrib/velocity/lib" regex=".*\.jar" />
<lib dir="${solr.exlib.dir:}/dist/" regex="solr-velocity-\d.*\.jar" />

Now you can move the config around without haveing to hack up solrconfig.xml everytime!