07 March, 2013

Solr integration with Liferay 6.1

If you want to setup solr with liferay and want to use solr as a search engine,
Guys you can follow below steps:

Its very quick and simple, Just try ....



Setting up Solr Server on Tomcat :

•   Download apache-tomcat-7.0.34.zip and apache-solr-1.4.1.zip from Apache Mirrors.
•   Create one folder called solr-server under base directory.
•   Place and unzip above zip files in server directory.
•   Create data directory in solr-server directory. This data directory will contain all the index data. So make sure the free space available in this directory should be as per the estimated data size.
•    Now give full rights to all the folders under  solr-server directory.
•    Make changes in server.xml file if you want to change the default http port of tomcat server.
•    Copy SOLR_HOME/example/solr/apache-solr-1.4.1.war to SOLR_HOME/example/solr/solr.war
•    Copy SOLR_HOME/example/solr/solr.war file to TOMCAT_HOME/webapps directory.
      SOLR_HOME = /opt/jignesh/solr-server/apache-solr-1.4.1
      TOMCAT_HOME = /opt/jignesh/
solr-server/apache-tomcat-7.0.34
•    Edit TOMCAT_HOME/bin/catalina.sh file and add below line before shell script code starts.
      export JAVA_OPTS=-Dsolr.solr.home='/opt/jignesh/server/apache-solr-1.4.1/example/solr'

•    Edit SOLR_HOME/example/solr/conf/solrconfig.xml file for setting solr index data directory.
      Update <dataDir> tag for setting data directory.
       <dataDir>${solr.data.dir: /opt/jignesh/server/data}</dataDir>
•    Start tomcat server from TOMCAT_HOME/bin/ and access the below URL.
      http://[IP ADDRESS]:[PORT]/solr


Configuration of solr-web plugin in Liferay :

•    Start the Tomcat server from Liferay Bundle.
•    Place .lpkg (i.e. 15187207_15857467_15857476.lpkg) file of solr-web plugin in tomcat’s deploy directory.
•    After solr-web plugin is deployed in Liferay, stop Liferay Tomcat server. Also stop the Solr Tomcat server which we have setup earlier on a separate tomcat instance.
•    Go to LIFERAY_HOME/tomcat-7.0.27/webapps/solr-web/WEB-INF/conf directory.
•    Copy/replace schema.xml file to SOLR_HOME/example/solr/conf directory on Solr Server.
•    Now go to LIFERAY_HOME/tomcat-7.0.27/webapps/solr-web/WEB-INF/classes/META-INF on Liferay Server.
•    Edit solr-spring.xml file and update value of Solr Server IP Address and Port number as mentioned in below example.
<bean id="com.liferay.portal.search.solr.server.BasicAuthSolrServer" class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">
<constructor-arg type="java.lang.String" value="http://[SOLR SERVER IP]:[PORT]/solr" />
</bean>
•    After above changes are done, first start the Solr Tomcat Server.
•    After starting Solr Tomcat Server, Start Liferay Tomcat Server.
•    When Liferay Server starts successfully, follow below steps,
     o    Login with admin user
     o    Go to the Control Panel > Server > Server Administration.
     o    Click on Execute Button beside Reindex all search indexes.




Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...