public static function solr_options()
    {
        if (self::$merged_solr_options) {
            return self::$merged_solr_options;
        }

        $defaults = array(
            'host' => 'localhost',
            'port' => 8983,
            'path' => '/solr',
            'version' => '4'
        );

        // Build some by-version defaults
        $version = isset(self::$solr_options['version']) ? self::$solr_options['version'] : $defaults['version'];

        /** @var Module $module */
        $module = ModuleLoader::getModule('silverstripe/fulltextsearch');
        $modulePath = $module->getPath();

        if (version_compare($version, '4', '>=')) {
            $versionDefaults = [
                'service'       => Solr4Service::class,
                'extraspath'    => $modulePath . '/conf/solr/4/extras/',
                'templatespath' => $modulePath . '/conf/solr/4/templates/',
            ];
        } else {
            $versionDefaults = [
                'service'       => Solr3Service::class,
                'extraspath'    => $modulePath . '/conf/solr/3/extras/',
                'templatespath' => $modulePath . '/conf/solr/3/templates/',
            ];
        }

        return (self::$merged_solr_options = array_merge($defaults, $versionDefaults, self::$solr_options));
    }
public static function solr_options()
    {
        if (self::$merged_solr_options) {
            return self::$merged_solr_options;
        }

        $defaults = array(
            'host' => 'localhost',
            'port' => 8983,
            'path' => '/solr',
            'version' => '4'
        );

        // Build some by-version defaults
        $version = isset(self::$solr_options['version']) ? self::$solr_options['version'] : $defaults['version'];

        /** @var Module $module */
        $module = ModuleLoader::getModule('silverstripe/fulltextsearch');
        $modulePath = $module->getPath();

        if (version_compare($version, '4', '>=')) {
            $versionDefaults = [
                'service'       => Solr4Service::class,
                'extraspath'    => $modulePath . '/conf/solr/4/extras/',
                'templatespath' => $modulePath . '/conf/solr/4/templates/',
            ];
        } else {
            $versionDefaults = [
                'service'       => Solr3Service::class,
                'extraspath'    => $modulePath . '/conf/solr/3/extras/',
                'templatespath' => $modulePath . '/conf/solr/3/templates/',
            ];
        }

        return (self::$merged_solr_options = array_merge($defaults, $versionDefaults, self::$solr_options));
    }
public static function solr_options ( ) { if ( self :: $ merged_solr_options ) { return self :: $ merged_solr_options ; } $ defaults = array ( 'host' => 'localhost' , 'port' => 8983 , 'path' => '/solr' , 'version' => '4' ) ; // Build some by-version defaults $ version = isset ( self :: $ solr_options [ 'version' ] ) ? self :: $ solr_options [ 'version' ] : $ defaults [ 'version' ] ; /** @var Module $module */ $ module = ModuleLoader :: getModule ( 'silverstripe/fulltextsearch' ) ; $ modulePath = $ module -> getPath ( ) ; if ( version_compare ( $ version , '4' , '>=' ) ) { $ versionDefaults = [ 'service' => Solr4Service :: class , 'extraspath' => $ modulePath . '/conf/solr/4/extras/' , 'templatespath' => $ modulePath . '/conf/solr/4/templates/' , ] ; } else { $ versionDefaults = [ 'service' => Solr3Service :: class , 'extraspath' => $ modulePath . '/conf/solr/3/extras/' , 'templatespath' => $ modulePath . '/conf/solr/3/templates/' , ] ; } return ( self :: $ merged_solr_options = array_merge ( $ defaults , $ versionDefaults , self :: $ solr_options ) ) ; }
Get the configured Solr options with the defaults all merged in
@return array - The merged options
Get the configured Solr options with the defaults all merged in