Setting up Solr on SSP

Note: Using Solr on SSP requires an additional server per environment to host the configuration and resources for Solr. If you require one, please talk to your account manager or contact the helpdesk. This document is only relevant to Solr environments created after April 1st 2019.

Some SilverStripe Platform environments make use of the Solr search engine, if your stack does there are some prerequisites:

Firstly, The QueuedJobs and Fulltextsearch modules need to be installed. The fulltextsearch module must be at least version 3.5.0 in order to support the “post” Solr mode.

SS3 only: If using a fulltextsearch version only compatible with SilverStripe 3 sites you will need to create a custom Solr Config Store identical to this and reference that in the call to Solr::configure_server i.e. 'mode' => 'MyCustomConfigStore',.

The same Solr server can be used across the base stack and its virtual stacks but please ensure the index names are different per stack to avoid using the index from stack A on stack B etc. To re-use the Solr server between base and virtual environments make sure to copy the Solr environment variables from the base stack to the virtual stacks.

The following is the minimum Solr configuration required in your _config.php file for a SilverStripe 4 site:

use SilverStripe\FullTextSearch\Solr\Solr;
use SilverStripe\Core\Environment;

    'host' => Environment::getEnv('SOLR_SERVER'),
    'port' => Environment::getEnv('SOLR_PORT'),
    'path' => Environment::getEnv('SOLR_PATH'),
    'version' => Environment::getEnv('SOLR_VERSION'),
    'indexstore' => [
        'mode' => Environment::getEnv('SOLR_MODE'),
        'path' => Environment::getEnv('SOLR_INDEXSTORE_PATH'),

The SOLR_* environment variables will be automatically set by the SilverStripe Platform team after your Solr server has been created. A full deployment will be required in order for them to be applied to each environment.

A cron is also required to run the queued fulltext search jobs, this needs to be added to .platform.yml:

    time: '* * * * *'
    sake_once: "dev/tasks/ProcessJobQueueTask"
    vhost: "mysite"

For a virtual stack, replacing “vstack” with your virtual stack’s code:

    time: '* * * * *'
    sake_once: "dev/tasks/ProcessJobQueueTask"
    vhost: "vstack"

Once you have this configuration in place you can begin creating your indexes following the documentation.