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 article shows how to integrate Solr within Liferay Portal. Note that Liferay portal version must be 6 or above.
And moreover, this article is abstracted from the book: Liferay Portal 6 Enterprise Intranets
• Download the latest version of Solr from http://lucene.apache.org/solr/; 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.0.
• Create a Tomcat Context fragment called solr.xml with 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" override="true"/>
</Context> • Drop the file solr.xml into the folder $TOMCAT_AS_DIR/conf/Catalina/localhost
• Add 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 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
Repeat the above steps with different installation directories to run multiple instances of Solr side-by-side. Starting Tomcat, the Solr admin should be available at http://${solr.host.domain}:${solr.port.number}/solr/admin, where ${solr.host.domain} represents Solr instance domain name, like locahost; ${solr.port.number} represents Solr instance port; number, like 8080.
• Download WAR file ${solr.web.war} from
or
• 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.
0 Attachments | Average (2 Votes) ![]() ![]() ![]() ![]() |