Monday, December 31, 2012

Integrating Solr with Liferay 6

Building Solr & Installing Solr instance on tomcat.
  1. Download Solr-1.3.0 release from Solr.
  2. Unzip .tar on some location. For eg. /opt/solr/
  3. Make /opt/solr/example/solr as a $SOLR_HOME.
  4. Copy apache-solr-1.3.0.war file from /opt/solr/dist and paste it into /opt/solr/example/solr.
  5. Open up the /opt/solr/example/solr/conf/solrconfig.xml
    Replace
    <dataDir>${solr.data.dir: ./solr/data}</dataDir>
    by following 
    <dataDir>${solr.data.dir:/opt/solr/example/solr/data}</dataDir>
    Note: The dataDir can also be temporarily overridden with the JAVA_OPTS environment variable  prior to starting Tomcat
             export JAVA_OPTS="$JAVA_OPTS -Dsolr.data.dir=/opt/solr/example/solr/data"
  1. It is recommended to run the Solr instance on separate tomcat instance other than liferay tomcat.
  2. So for separate tomcat for solr, consider it here. $SOLR_TOMCAT
  3. Into $SOLR_TOMCAT/conf/Catalina/localhost , create one solr.xml file and copy following content into the file and save it.

  1. Now start tomcat and check that it is running without any error or not.
Integrating Solr plugin with Liferay

  1. Download Solr plugin which is compatible with the Liferay version.
  2. Drop the plugin into $LIFERAY_HOME/deploy directory.
  3. Start liferay tomcat server. After started liferay tomcat, just stop both the tomcat servers (SOLR_TOMCAT and LIFERAY_TOMCAT).
  4. Openup the $LIFERAY_HOME/tomcat-6.0.18/webapps/solr-web/WEB-INF/classes/META-INF/solr-spring.xml
           for bean id=”solrServer” give the solar tomcat settings and save it.
           for eg. http://localhost:8181/solr
  1. Copy the $LIFERAY_HOME/tomcat-6.0.18/webapps/solr-web/WEB-INF/conf/schema.xml file and paste it into /opt/solr/example/solr/conf/ directory.


Congratulation, you have done!

11 comments:

  1. hi amit does we need to follow same step in windows machine too.

    ReplyDelete
  2. sorry for being late to reply .

    yes hemant kumar.. we need to follow the same step in windows too.

    ReplyDelete
  3. Great Article
    Thanks for contribution.
    Configured successfully.!

    ReplyDelete
  4. hi Amit,

    I have configured above step...but how to index the data and see the result in Liferay

    ReplyDelete
  5. Hi Amith,
    i got the error,
    SEVERE:error deploying configuration descriptor solr.xml

    ReplyDelete
  6. Tried integrating Solr 4.1.0 with liferay 6.1 and encountered errors.. i am looking for complete integration guidelines ... could you please suggest some important reference material...

    ReplyDelete
  7. With Solr4 I expect that the Schema.xml should be changed

    ReplyDelete
  8. Hi Umer,

    I updated the Solr.xml , now it will not face the issue.

    ReplyDelete
  9. SHRIHARSH & thePanz

    Still I have not gone through solr 4.1. But I think Steps should remain the same.

    Thanks

    ReplyDelete
  10. Hi Amit,

    I gone through this step with Windows and it's working fine.
    Configure successfully......

    Thank you for sharing

    ReplyDelete
  11. Hi Amit,
    I followed your steps and when i start servers not seeing any errors but reindexing throuh control panel still using luceneindexer and not seeing any activity under solr plugin. Can you please tell me whats wrong.
    Liferay version: 6.1.1CE GA2
    Solr: 1.3.0
    Plugin: solr-web-6.1.0.1-ce-ga1-20120106155615760.war

    ReplyDelete

nRelate Posts Only