/
Apache Solr user guide

Apache Solr user guide

Local solr configuration

Every time you pull a database down from Pantheon, you will need to disable the pantheon_apachesolr module, which will otherwise prevent you from connecting to the local solr on your local solr configuration:

$ drush -y dis pantheon_apachesolr

 

Posting the Solr Schema

When you first create an environment – locally, on DEV, TEST, LIVE or for any MULTIDEV on Pantheon, you will need to repost the Solr schema.

This is done in the UI at /admin/config/search/pantheon

 

 

Rebuilding the solr index

Every time you pull a fresh database down, you will want to clear out the contents of your local index and re-index it.

A) via the UI

The status of the index reported at admin/config/search/search_api/ is provided by the Drupal database. If you just pulled a new database down, you're looking at the state of the upstream solr, not your local index. You can clear out the index from the Drupal UI at the above page by first clicking on the index name, then the "Clear all indexed data" button at the bottom of the page.

You can click the "Index now" button, but we suggest drush for all solr operations however.

 

B) With Drush


Let's see what we have:

$ drush search-api-status
Id Index % Complete Indexed Total
4 my_custom_index 100% 22680 22680


We find the ID of the solr index (4 here, but the number may differ for you). If this was a fresh DB pull, the indexed % represents what was upstream, not on your local solr.

We need tell drupal it will have to re-index the solr.

$ drush search-api-reindex 4
  my_custom_index was successfully marked for re-indexing.


This command does not actually do any indexing, it just clears out the index:

$ drush search-api-status
Id Index % Complete Indexed Total
4 my_custom_index 0% 0 1597


Now, we perform the indexing operation, specifying the solr index ID (4), and the number of items to index (2000). We can also increase the batch size up from its default (10) to a more impressive count (50):

$ drush search-api-index 4 2000 50

 

and (eventually) we can verify our index status for completeness

$ drush search-api-status
Id Index % Complete Indexed Total
4 my_custom_index 100% 1597 1597


Run search-api-index again if you add new fields to the solr index locally, or new content you want indexed. No need to clear it out every time, just when you grab a new upstream database.

Related content

Manually building a Kalastack with Solr
Manually building a Kalastack with Solr
More like this
Drupal 8 -> 9 upgrade guide for existing Pantheon sites using Kalamuna Drupal Project
Drupal 8 -> 9 upgrade guide for existing Pantheon sites using Kalamuna Drupal Project
More like this
Troubleshooting Pantheon Issues
Troubleshooting Pantheon Issues
More like this
Creating a Pantheon website with no defined upstream
Creating a Pantheon website with no defined upstream
More like this
Fix Pantheon Site aliases with a policy file
Fix Pantheon Site aliases with a policy file
More like this
Migrating to Pantheon
Migrating to Pantheon
More like this