5 Steps to Build a WordPress Search UI With Solr Power and Lucidworks Managed Search

Apache Solr , General , Lucidworks Managed Search , Technical Article , Tutorials and Documentation

5 Steps to Build a WordPress Search UI With Solr Power and Lucidworks Managed Search

Quickly leverage the latest version of Solr with your Wordpress site for unmatched security, reliability, and relevance.

byMarcus Eagan on May 21, 2020

As we work with early customers to evaluate our Lucidworks Managed Search offering for Apache Solr (which will be generally available this summer) we’re finding that many of them want to be able to leverage their WordPress, Drupal, and AEM instances. The trouble with current Solr plugins for these systems is that they are not maintained on the latest version of Solr and they cannot handle the scale that most customers need.

I’ve written blogs on integratingDrupal andAEM, and now I’m sharing how easily you can integrate Lucidworks Managed Search with WordPress to handle a high volume of search traffic. The features that we offer with LMS allow you to migrate quickly, only pay for what you use, and recover quickly.

In this post, I will show how you can quickly deploy a WordPress search UI in the cloud using the latest version of Apache Solr. These instructions require that an account is set up but you cancontact us to learn more.

Comparing WordPress with Lucidworks Managed Search vs Vanilla Solr

Features L ucidworks Managed Search WP Solr Plugin
Compatible with Solr Yes Yes
Works wIth SolrCloud Yes Yes
Auto-Backup and Restore Yes No
Usage-Based Auto-scaling Yes No
Schedule-Based Auto-scaling Yes No
Enterprise Security Yes Configurable
Comprehensive Dashboard Yes No
API-Driven Cluster Creation Yes No
Activity Log Yes No
Version of Solr SOLR 8.4.1 or latest stable SOLR 6.2 or earlier

Steps:

1.Skip this step if you already have an existing WordPress instance set up and deployed. Download and set the WordPress site https://wordpress.org/download/ in your server’s (e.g. Apache2) root directory path.

Here’s a screenshot of showing this change for Apache 2’s httpd.conf file. Once set, restart your server.

Next, setup a SQL database for the WordPress site, and follow the standard installation process.

2.Download the .zip archive of the WP Solr plugin from here .

3.Install WP Solr Plugin: To directly upload the plugin instead of using ftp, open site/wp-config.php file, and add the define(‘FS_METHOD’, ‘direct’); before other define directives.

Before the plugin can be activated, you need to install the following:

A. Go to the plugin directory:

cd site/wp-content/plugins/managed-search-wordpress-master/

B. Run the following command:

composer config repositories.private-packagist composer https://repo.packagist.com/lucidworks/ && composer config repositories.packagist.org false

Since we use a private module (lucidworks/managed-search-solarium) this helps set the repository path.

C. Run composer install

D. Run

npm install && grunt

If you don’t have grunt installed, you can install it globally on your system with

npm install -g grunt.

Add the Solr environments in your site’s wp-config.php file

define('FS_METHOD', 'direct');
putenv('SOLR_HOST=pg01.us-west1.cloud.lucidworks.com');
putenv('SOLR_PORT=443');
putenv('SOLR_POWER_SCHEME=https');
putenv('SOLR_PATH=/some-path');
putenv('OAUTH2_CLIENT_ID=someclientID');
putenv('OAUTH2_CLIENT_SECRET=WTjGhFsomesecrety');
putenv('SOLR_COLLECTION=wp-test');

4.Upload the configset.zip as present in this repository and apply the configset to the Solr collection as set in the environments.

curl --location --request POST 'https://pg01.us-west1.cloud.lucidworks.com/mycluster/a-node/solr/admin/config
s?action=UPLOAD&name=wp-configset' \
--header 'Content-Type: application/octet-stream' \
--header "Authorization: Bearer $TOKEN" \
--data-binary '@wp-configset.zip'

The above API call uses $TOKEN which requires a valid Bearer token. You can get one via the following REST API call:

curl -X POST \
https://cloud.lucidworks.com/oauth2/default/customer/v1/token \
-H 'Accept-Encoding: gzip, deflate' \
-H 'accept: application/json' -H 'Cache-control: no-cache' \
-H 'authorization: Basic base64($oauth2_client_id:$oauth2_client_secret)' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials&scope=customer'

Response Format:

{ "token_type":"Bearer", "access_token":"$TOKEN", "scope":"com.lucidworks.cloud.search.solr.customer", "Expires_in":3599 }

Once you’ve uploaded the config set, you can visit the Solr Admin UI to create a collection with the config set applied.

Note: If you had already set a collection in the drupal site, delete the collection prior to re-creating it with the config set.

At this point, you can activate the plugin.

Once the plugin is activated, it will also appear as a menu item with the name Solr Power.

You can click on the menu to see the Solr Configuration status.

You can use the Actions, Indexing Options and Facet Options tabs to reset the index, configure how the search should work and set faceting options.

That’s all! You’re now set to use the Solr Power plugin for WordPress. Below, you can see an example of a query to LMS in WordPress.

If you would like to see it in action, click thecontact us button and fill out the form so our team can help you get started.

我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章