Configure SOLR with Liferay
Follow below steps to configure SOLR server with Jetty with Liferay.
1. Download and
unzip Solr 4.3.1 to a convenient location
Treat the root of the unzipped Solr as $solr_home.
2. Navigate to $solr_home/example and execute "java -jar
start.jar"
3. Your solr server is now running (on Jetty) on port 8983. You can change
the port in $solr_home/example/etc/jetty.xml if you wish to do so. This
article assumes you have not changed the port from the default value.
b. You should see Solr’s admin page:
4. Once you’ve confirmed that the server is running, stop the Solr server.
5. Start up Liferay Portal (server) treat the root of the bundle as $liferay-home
6. Download the Solr plugin from
the marketplace and deploy it to the portal.
7. Once the plugin is deployed, stop the portal.
8. Navigate to $liferay-home/tomcat-7.0.42/webapps/solr4-web/WEB-INF/classes
/META-INF and edit the file called solr-spring.xml.
Look for the following snippet:
8080/solr" />
and change the port to 8983:8983/solr" />
9. Copy the file from below mentioned path.
$liferay-home/webapps/solr4-web/WEB-INF/conf/schema.xml
to $solr-home/example/solr/collection1/conf
10.
Copy the
$liferay-home/webapps/solr4-web/WEB-INF/conf/solrconfig.xml
to
$solr-home/example/solr/collection1/conf
11.
Start the Solr server.
12. Start Liferay.
13.
Navigate to the Liferay
Control
Panel -> Server Administration and execute a full reindex
To test the whether the connection is
alive, check Solr’s log. Every 10 seconds, Liferay pings the Solr server, which
shows up in Solr’s log as such:
395631 [qtp227416342-15] INFO
org.apache.solr.core.SolrCore – [collection1] webapp=/solr path=/admin/ping params={wt=javabin&version=2}
hits=0 status=0 QTime=1
395631 [qtp227416342-15] INFO
org.apache.solr.core.SolrCore – [collection1] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} status=0 QTime=1
To see if the reindex was successful,
navigate to Solr’s admin page, select “Collection1” from the dropdown, click on
Query, then on “Execute Query”. Solr should show you everything it has indexed
so far:
Common issues:
Not enough memory
By default, Jetty starts with 4g heap
size and 82mb Perm size. If for some reason this is not enough for your test
scenario, you can change the allocated memory by specifying additional
parameters:
java -jar
-Xmx8g -XX:MaxPermSize=128m start.jar
Note: you
can check the memory allocations by running jmap -heap
undefined field _
In Solr’s log:
ERROR org.apache.solr.core.SolrCore –
org.apache.solr.common.SolrException: undefined field companyId
In Liferay’s log:
WARN [liferay/search_writer/SYSTEM_ENGINE-1][ProxyMessageListener:81]
com.liferay.portal.kernel.search.SearchException: undefined field companyId
·
Make sure you have copied the
schema.xml from the Solr EE plugin to the Solr server. See step 9 above.
·
If the schema.xml is updated, you’ll
need to restart the Solr server.
Liferay cannot reach Solr server
In Liferay’s log:
WARN
[liferay/search_writer/SYSTEM_ENGINE-2][ProxyMessageListener:81]
com.liferay.portal.kernel.search.SearchException: Server at
http://localhost:8080/solr returned non ok status:503, message:Service
Unavailable
·
Make sure you have modified the
solr-spring.xml to point to the correct location. See step 8 above.
·
If you modified the solr-spring.xml,
you’ll need to restart Liferay.
Comments