问:我在启动Solarium Client时遇到问题,我是通过Composer下载的。我将其安装在供应商中当我想从solr获取文档时,我必须爬行一个Client实例
$ client =新的Solarium \ Client($ config); 我收到此错误错误:
找不到类“ Solarium”文件:D:\ wamp \ www \ DcSearch \ app \ Controller \ UsersController.php我不知道我错过了什么:
App :: uses('HttpSocket','Network / Http'); App :: import('Vendor','autoload',array('file'=>'solarium / vendor / autoload.php'));;
类UsersController扩展了AppController {
公共功能 find () {
$ config = 数组(
“ endpoint” => 数组(“ localhost” => 数组(“ host” => “ 127.0.0.1” ,
“端口” => “ 8983” , “路径” => “ / solr” , “核心” => “演示” ,)
) );
$ client = 新的Solarium /客户端($ config );
$ client- > setAdapter ('Solarium \ Core \ Client \ Adapter \ Http' );
..........
答:我解决了prb步骤一,在Vendor / solarium中更新了composer.json
{
“要求”:{
“日光浴室/日光浴室”:“ 3. *”
},“自动加载”:{
“ psr-0”:{“ Solarium \\”:“ library /”}
}}
第2步我用
App :: import('Vendor','autoload',array('file'=>'solarium / vendor / autoload.php'));;