1

I'm using the Search API Solr module for search on my Pantheon site. Pantheon's Solr module automatically sets the search index for the dev, staging, and live environments.

But now I want to install Solr locally and I want to use that index instead on my local dev environment. I know I can change the environment settings in settings.php-- I have already done this for some things on my local environment.

I defined the Server for my local copy of Solr at admin/config/search/search_api. I have two different Indexes on this page, and these default to the Pantheon Server. I can easily switch them to the local solr Server, but I don't want to do this every time I reset my dev environment.

What variable can I set to force the Indexes to use my local Solr Server?

2

Sadly, Solr servers and their settings are not variables. They're not entities, nor anything else Drupal would know about, and subsequently be able to effect.

The settings for the server host/path are stored in a serialised PHP string in the search_api_server table. (the options column).

The best I think you'll be able to do is to add a step to your pull-from-pantheon process to run a script after the database has been updated. The script would perhaps delete all existing servers and add a new record with only the known good configuration for your local host.

Or you could have a module enabled locally only that checks for the host on each request, something like that. I don't think there's a way to do it without altering the database manually, or at least by using one of the API functions provided by search_api_solr.

| improve this answer | |
  • Argh... in that case, I will use Selenium IDE to automatically click through the process of switching the indexes for me. – Patrick Kenny Apr 7 '16 at 14:07
  • I feel your pain! I keep threatening to rewrite the config for this module so its environment-friendly but life keeps getting in the way – Clive Apr 7 '16 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.