There are two ways to install the Liferay Connector to Solr 7:
- Navigate to Liferay Marketplace and download the app that corresponds to your portal.
Once the app LPKG is downloaded, copy it to Liferay_Home/osgi/marketplace
.
- In your running portal instance, navigate to Control Panel → Apps → Store. Sign in using your credentials, search for Solr Search Engine, and purchase (it’s free) the Liferay Connector to Solr 7 entry.
As you proceed, remember these terms:
Solr Home: The center of the Solr system (pun intended). This directory is
solr-[version]/server/solr
.
Liferay Home: The root folder of your Liferay DXP installation. It contains
the osgi
, deploy
, data
, and license
folders, among others.
There are two installation steps:
-
Installing and configuring Solr 7.
-
Installing and configuring the Solr 7 connector for Liferay DXP.
Before configuring Liferay DXP for Solr, install and set up Solr.
Installing and Configuring Solr 7
To install and properly configure Solr for Liferay DXP:
-
Download Solr and unzip it.
-
Navigate to
solr-[version]/server/solr
. This is Solr Home. -
Create a new folder called
liferay
. -
In the
liferay
folder, create two new folders:conf
anddata
. -
Copy the contents of
Solr_Home/configsets/_default/conf
toSolr_Home/liferay/conf
. -
Open the Liferay Connector to Solr 7’s LPKG file with an archive manager.
Open the
com.liferay.portal.search.solr7.impl.jar
file, and extractMETA-INF/resources/solrconfig.xml
and
META-INF/resources/schema.xml
to
Solr_Home/liferay/conf
This replaces the current
solrconfig.xml
andschema.xml
files with ones that tell Solr how to index data coming from Liferay DXP. -
Create a
core.properties
file inSolr_Home/liferay
and add this configuration:config=solrconfig.xml dataDir=data name=liferay schema=schema.xml
-
Checkpoint: your
Solr_Home/liferay
folder now has this structure:liferay ├── conf │ ├── lang │ │ ├── contractions_ca.txt │ │ ├── ....txt │ ├── managed-schema │ ├── params.json │ ├── protwords.txt │ ├── schema.xml │ ├── solrconfig.xml │ ├── stopwords.txt │ └── synonyms.txt ├── core.properties └── data
-
Start the Solr server by entering
./bin/solr start -f
from the top-level folder of your Solr installation (
solr-[version]
). -
The Solr server listens on port
8983
by default. Navigate tohttp://localhost:8983/solr/#/~cores
(assuming you’re testing locally withlocalhost
as your host), and confirm that theliferay
core is available.
Solr is now installed. Next install and configure the Solr connector.
Installing and Configuring the Liferay Solr Adapter
Since Elasticsearch is the default search engine, the Elasticsearch connector is already installed and running. You must stop it before configuring the Solr connector.
Stopping the Elasticsearch Connector
Stop the Elasticsearch connector bundle using the App Manager, the Felix Gogo
shell, or the bundle blacklist. If you’re a Liferay DXP customer, use the
blacklist feature as described below. The App Manager and Gogo shell rely on the
osgi/state
folder to “remember” the state of the bundle. If you delete this
folder (recommended during patching) the Elasticsearch connector is reinstalled
and started automatically.
Navigate to Control Panel → Apps → App Manager.
Once in the App Manager, search for elasticsearch. Find the Liferay Connector to Elasticsearch 6 module and click the Actions (()) button. Choose the Deactivate option. This leaves the bundle installed, but stops it in the OSGi runtime.
Alternatively, use the Felix Gogo shell to stop the Elasticsearch connector. Enter
lb elasticsearch
You’ll see two active bundles for the Liferay Connector to Elasticsearch 6: an API and an IMPL bundle.
ID|State |Level|Name
476|Active | 10|Liferay (CE) Connector to Elasticsearch 6 - API (3.0.0)
478|Active | 10|Liferay Portal Search Elasticsearch 6 API (3.0.4)
480|Active | 10|Liferay Portal Search Elasticsearch 6 SPI (3.2.1)
706|Active | 10|Liferay (CE) Connector to Elasticsearch 6 - Impl (3.0.0)
707|Active | 10|Liferay Portal Search Elasticsearch 6 Implementation (3.0.15)
Stop the API bundle by entering
stop [bundle ID]
In the example above, the [bundle ID]
is 476
.
Liferay DXP: DXP customers should blacklist the Elasticsearch, Shield, and Marvel plugins.
-
Create a
com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config
file with these contents:
blacklistBundleSymbolicNames=["com.liferay.portal.search.elasticsearch6.spi","com.liferay.portal.search.elasticsearch6.api","com.liferay.portal.search.elasticsearch6.impl","Liferay Enterprise Search Monitoring ","Liferay Enterprise Search Security "]
If the LES Security and Monitoring LPKG files are installed, you must blacklist these too.
-
Place the file in
Liferay Home/osgi/configs
.
Install and Configure the Solr Connector
Now you’re ready to install the connector:
-
Start Liferay DXP, then deploy the Solr connector by copying the LPKG you downloaded to
Liferay_Home/deploy
.You’ll see a
STARTED
message in your Liferay DXP log once the Solr connector is installed. Here’s what the log message looks like:2018-11-06 19:59:49.396 INFO [pipe-start 943 944][BundleStartStopLogger:39] STARTED com.liferay.portal.search.solr7.api_2.0.5 [943] 2018-11-06 19:59:49.490 INFO [pipe-start 943 944][BundleStartStopLogger:39] STARTED com.liferay.portal.search.solr7.impl_2.0.11 [944]
-
To re-index against Solr, navigate to Control Panel → Configuration → Search, and click Execute next to the Reindex all search indexes option.
In production deployments, specify your edits to the Solr connector’s default
configurations using a configuration file deployed to the Liferay_Home/osgi/configs
folder. Name the file
com.liferay.portal.search.solr7.configuration.SolrConfiguration.config
During testing and development, use the Solr 7 System Settings entry Control Panel → Configuration → System Settings for editing the default configurations.
The next article covers clustering Solr with SolrCloud.