Solr(solarium)与database.php中的laravel 5的连接

Solr(solarium)与database.php中的laravel 5的连接,php,laravel,solr,laravel-5,solarium,Php,Laravel,Solr,Laravel 5,Solarium,我使用laravel 5,并希望用它连接到solr 5。我用composer下载了solarium。但当我尝试连接时,它会出错 什么有效 在我的控制器中(就目前而言),我做到了: public function __construct() { $config = array( 'endpoint' => array( 'localhost' => array( 'host' => '127.0.0

我使用laravel 5,并希望用它连接到solr 5。我用composer下载了solarium。但当我尝试连接时,它会出错

什么有效

在我的控制器中(就目前而言),我做到了:

public function __construct()
{

    $config = array(
        'endpoint' => array(
            'localhost' => array(
                'host' => '127.0.0.1',
                'port' => 8983,
                'path' => '/solr/my_solr_instance',
            )
        )
    );

    // create a client instance
    $this->client = new \Solarium\Client($config);
}
然后在其他地方我会这样做:

$temp = $this->client;

// get a select query instance
$query = $temp->createQuery($temp::QUERY_SELECT);

// this executes the query and returns the result
$resultset = $temp->execute($query);

// display the total number of documents found by solr
echo 'NumFound: '.$resultset->getNumFound();
到目前为止,这是可行的。它返回正确的数字1: NumFound:1

问题

现在,我将创建实例更改为:

$this->client = new \Solarium\Client(\Config::get('solr')); 
我在config/database.php文件中添加了以下代码:

Config::get('database.solr')
然后,当我再次运行脚本时,它会说:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/select. Reason:
<pre> Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>
在database.php文件中:

Config::get('database.solr')

我相信您需要获得数据库配置:

'solr' => [
    'endpoint' => [
        'localhost' => [
            'host' => '127.0.0.1',
            'port' => 8983,
            'path' => '/solr/my_solr_instance',
        ],
    ],
],
Config::get('database.solr')