Liferay integration with solr
Configure solr with Tomcat 7
Step -1
- Download Solr from apache website. Here we are using solr 4.*.*.(solr-4.3.1.tgz)
- Download tomcat from apache website(apache-tomcat-7.0.75.zip).
- Create a folder called "solr".
- Unzip both files on solr folder.( tar -xvf yourfile.tar)
- Copy solr<version>.war from <extracted_solr>\dist
to <extracted_tomcat>\webapps and rename solr<version>.war to solr.war.
- Copy all jars in <extracted_solr>\example\lib\ext to <extracted_tomcat>\lib.
Change the port to 8006
<Server port="8005" shutdown="SHUTDOWN">
Change ajp port to 8008
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
- Change the port to 8983 in server.xml file of tomcat . (in different instance no need for this step)
- Start the tomcat.
- Check New folder names solr would be available in webapps.
- Shutdown the tomcat.
- Modify web.xml located at <extracted_tomcat>\webapps\solr\WEB-INF
Uncomment below entry and update the path for solr\home.
<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value> <extracted_solr>C:/Solr/solr-4.3.1/example/solr</env-entry-value> <env-entry-type>java.lang.String</env-entry-type></env-entry>
- Start the tomcat and access the below URL.
http://[IP ADDRESS]:[PORT]/solr or http://localhost:[PORT]/solr
Step-2:
Setup solr-web plugins in liferay :
* Download the solr web from liferay market place (Liferay Solr 4 Search Engine.lpkg) .
* Copy the solr-web war file to deploy folder of liferay-server
* After solr-web plugin is deployed in Liferay, stop Liferay Tomcat server.
- Go to <Liferay>/tomcat-7.0.27/webapps/solr-web/WEB-INF/conf directory.
- Copy and replace schema.xml file to <extracted_solr>example/solr/collection1/conf directory on solr server.
* Go to < liferay>/tomcat-7.0.42/webapps/solr4-web/WEB-INF/classes/
Edit solr.properties file to update with property server.http.url
And value should be< solr-ip>:8983/solr
* Edit the solrconfig.xml file and update the values as below
<extracted_solr>example/solr/collection1/conf directory on Solr Server.
<autoCommit>
<maxTime>10000</maxTime>
<openSearcher>true</openSearcher>
</autoCommit>
* Creare the log4j.properties file in C:\Solr\apache-tomcat-7.0.75\lib and add the below properties
# Logging level
log4j.rootLogger=INFO, file, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
#- size rotation with log cleanup.
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.MaxFileSize=4MB
log4j.appender.file.MaxBackupIndex=9
#- File to log to and log format
log4j.appender.file.File=C:\\Solr\\apache-tomcat-7.0.75\\logs\\solr.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; %C; %m\n
log4j.logger.org.apache.zookeeper=WARN
- After above changes are done, first start the Solr Tomcat Server after start Liferay Tomcat server.
- When Liferay Server starts successfully, follow below steps,
-> Login with admin user
-> Go to the Control Panel > Server > Server Administration.
-> Click on Execute Button beside Reindex all search indexes.