public static function configure()
    {
        if (!class_exists(Solr::class)) {
            return;
        }

        // get options from configuration
        $options = static::config()->get('options');

        // get version specific options
        switch ($options['version']) {
            case 'cwp-4':
                $solrOptions = self::options_for_cwp($options);
                break;
            case 'local-4':
                $solrOptions = self::options_for_local($options);
                break;
            default:
                throw new InvalidArgumentException(sprintf(
                    'Solr version "%s" is not supported on CWP. Please use "local-4" on local ' .
                        'and "cwp-4" on production. For preferred configuration see ' .
                        'https://www.cwp.govt.nz/developer-docs/.',
                    $options['version']
                ));
                break;
        }

        // Allow users to override extras path.
        // CAUTION: CWP does not permit usage of customised solrconfig.xml.
        if (isset($options['extraspath']) && file_exists($options['extraspath'])) {
            $solrOptions['extraspath'] = $options['extraspath'];
        } elseif (file_exists(BASE_PATH . '/app/conf/extras')) {
            $solrOptions['extraspath'] = BASE_PATH . '/app/conf/extras';
        }

        Solr::configure_server($solrOptions);
    }