Is it possible to use multiple indexes with Apache Solr? We want to use different indexes depending on the environment id.
2 Answers
Setup multiple solr core's and then use settings.php to define for each environment as poster above said.
If you are using ApacheSolr its like:
$conf['apachesolr_environments']['my_env_id']['url'] = 'http://localhost:8983'; Just make sure your settings.php is not moved from server to server, if it is then use environment variable in apache:
SetEnv ENVIRONMENT development SetEnv ENVIRONMENT staging SetEnv ENVIRONMENT production And use something like this in settings.php
<?php switch ($_SERVER['ENVIRONMENT']) { case 'development': $conf['apachesolr_environments']['my_env_id']['url'] = 'http://localhost:8983'; break; case 'production': $conf['apachesolr_environments']['my_env_id']['url'] = 'http://www.domain.com:8983'; break; } ?> Yes. One way to do this [on a single Solr server] use Multi-core Solr, and have an index for each environment (Dev, Staging/Test, Prod/Live).
You'll probably want to customize the index file per environment based through some flag you'd set in settings.php (per environment); there are utility modules that help split settings amongst each env.