Enabling Solr for WordPress

Detailed information on using Apache Solr with WordPress.


Apache Solr is a system for indexing and searching site content. Currently, all plans except for a Personal plan can use Solr.

First, you will need to add the Index Server to your site. From your Dashboard, go to Settings > Add Ons > Apache Solr Index Server: Add. This will provision Apache Solr containers for every environment for your site. You are now ready to begin integrating with WordPress.

Get DevOps Training

Learn how to configure Solr with help from our experts. Pantheon delivers custom workshops to help development teams master the platform and improve internal DevOps.

Solr Search for WordPress

Pantheon supports and maintains Solr Search for WordPress (Solr Power). This plugin replaces the default search mechanism within WordPress while preserving the familiar integration methods within themes and widgets.

Install and Configure Plugin

  1. Set the connection mode to SFTP for the Dev or Multidev environment via the Pantheon Dashboard or with Terminus:

    terminus connection:set <site>.<env> sftp
    
  2. Install and activate the Solr Search for WordPress (Solr Power) plugin on the Dev or Multidev environment using the WordPress Dashboard or with Terminus:

    terminus wp <site>.<env> -- plugin install --activate solr-power
    
  3. From the WordPress Dashboard, navigate to Solr Options (previously under Settings). You should see your site's Solr Server details within the Info tab.

  4. Select Indexing Options from the navigation bar and configure desired indexing options for Solr. Click Save Changes after making modifications.

    Note

    You can exclude pages or posts from being indexed by providing the numeric ID of the item (comma separated) in the Excludes Posts or Pages field.

  5. Index all publicly queryable post types by navigating to the Actions tab and clicking Execute next to Index Searchable Post Types, or via Terminus:

    terminus wp <site>.<env> -- solr index
    
  6. Deploy the plugin to the site's Test and Live environments after validation and testing.

Optimize Index

For details, see the Optimize command document.

Schema.xml

Upon activation of the plugin on the Dev or Multidev environment, a default schema.xml document is automatically sent to the Solr server. The schema.xml file is submitted automatically when deploying the plugin to another environment on Pantheon.

You can set a custom schema.xml by uploading it to the /wp-content/uploads/solr-for-wordpress-on-pantheon/ directory using SFTP. Then, from the plugin's Actions tab, look for Repost schema.xml and click on Execute.

Note

Custom schema.xml files exist outside of version control, and must be uploaded to each environment seperately.

Known Issues/Limitations

This plugin is under active development on GitHub. Use the issue queue for status updates and support. Pull requests are also welcome!

Re-Indexing

New, deleted, and modified posts and pages are automatically added to the Solr index. However, if you modify the indexing options within Settings > Solr Options > Indexing, you must manually re-index the site on the Actions tab.

Enable Solr for AJAX and WordPress Dashboard

Use the solr_allow_ajax and the solr_allow_admin filters to allow Solr to work with AJAX and within the WordPress Dashboard.