Mar 12
5
Technical guide line for installing solr & integrating it with Liferay Portal.
- Install tomcat 6 or up version on one machine where liferay portal is not running.
- Download the solr 1.4.1 version from http://mirrors.axint.net/apache//lucene/solr/1.4.1/, install it and mark the root of installation folder as the variable $SOLR_HOME.
- Copy the WAR file $SOLR_HOME/dist/apache-solr-${solr.version}.war into $SOLR_HOME/example; where ${solr.version} represents Solr version number, i.e., 1.4.1
Configure Tomcat
- Create a Tomcat Context fragment called solr.xml with the following lines:
<?xml version=”1.0″ encoding=”utf-8″?>
<Context docBase=”$SOLR_HOME/example/apache-solr-${solr.version}.
war” debug=”0″ crossContext=”true”>
<Environment name=”solr/home” type=”java.lang.String”
value=”$SOLR_HOME/example/solr” override=”true”/>
</Context>
- Drop the file solr.xml into the folder $TOMCAT_AS_DIR/conf/Catalina/localhost.
- Add the following line at the end of $TOMCAT_AS_DIR/bin/setenv.sh for Linux or MacOS as follows:
JAVA_OPTS=”$JAVA_OPTS -Dsolr.solr.home=$SOLR_HOME/example/solr/data
- Or add the following line at the end of $TOMCAT_AS_DIR/bin/setenv.bat for Windows as follows:
set JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home=$SOLR_HOME/example/solr/data
Configure Solr plugin
- Once the Solr instance is set, Install the Solr plug-in in the portal. How does it work? The following is a sample which could bring the plugin Solr into the portal.
- Download WAR file ${solr.web.war} from
http://en.sourceforge.jp/projects/sfnet_lportal/downloads/Liferay%20Plugins/6.0.5/solr-web-6.0.5.1.war/
- Drop the WAR file ${solr.web.war} to the folder $LIFERAY_HOME/deploy when the portal is running
- After deploying successfully, you should shut down the portal and Solr instance, and moreover, configure the Solr instance with the Solr plugin as follows.
- Open $AS_WEB_APP_HOME/solr-web/WEB-INF/classes/META-INF/solr-spring.xml and update Solr instance settings as follows
<bean id=”solrServer” class=”com.liferay.portal.search.solr.server.BasicAuthSolrServer”>
<constructor-arg type=”java.lang.String” value=” http://${solr.host.domain}:$ {solr.port.number}/solr” />
</bean>
- Drop the schema file schema.xml from $AS_WEB_APP_HOME/solr-web/WEB-INF/conf to $SOLR_HOME/example/solr/conf in the domain ${solr.host.domain} – replacing the exiting the schema file schema.xml; and restart Solr instance and the portal.

