Thursday, March 3, 2011

Solr Integration with Liferay

Solr Integration with Liferay

Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, and rich document (e.g., Word, PDF) handling. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites. Refer to Apache Solr

This document shows how to integrate Solr within Liferay Portal. Note that Liferay portal version must be 6 or above.

Integration steps :

1 . Download the latest Solr from this link. Extract somewhere this zip file, and I will call this extracted folder as SOLR_HOME.

  1. Download the solr-web-6.0.1.1 war file and deploy the war file in liferay tomcat server.

  2. Copy the schema.xml file from the solr-web/WEB-INF/conf folder which is deployed and paste/replace in SOLR_HOME/example/solr/conf folder.

  3. Change the solr url as follows in solr-spring.xml which is located in solr-web/WEB-INF/classes/META-INF/ folder.

Change from this content :

<bean id="solrServer"
class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">

<constructor-arg type="java.lang.String" value="http://localhost:8080/solr" />

</bean>

to this :

<bean id="solrServer"
class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">

<constructor-arg type="java.lang.String" value="http://localhost:8983/solr" />

</bean>


Note :
8983 is the default port for Solr.
  1. Now shutdown the tomcat server.

  2. Start the Solr server using the following command from SOLR_HOME/examle folder in command prompt/terminal.

Java -jar start.jar

  1. Start the liferay tomcat server now.

  2. Now add the search portlet in your home page and test your searches. When ever you search anything you can see some log info in solr server.

Note : By defaut Solr searches for the new webcontent, wiki, blogs... etc from the time Solr is integrated. To search the complete portal reindex all search indexs from the server administration which is in control panel.

Share & Enjoy

Twitter Delicious Facebook Digg Stumbleupon Favorites More