src/Solr/CwpSolr.php
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);
    }
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);
    }
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 ) ; }
Configure Solr.

$options - An array consisting of:

'extraspath' - (String) Where to find Solr core configuartion files.
Defaults to '<BASE_PATH>/app/conf/extras'.
'version' - select the Solr configuration to use when in CWP. One of:
* 'cwp-4': preferred version, uses secured 4.x service available on CWP
* 'local-4': this can be use for development using silverstripe-localsolr package, 4.x branch
Configure Solr .