按http://laravelacademy.org/post/3781.html 安装了Elasticsearch(启动后通过curl -X GET http://localhost:9200 测试正常返回信息) 及mmanos/laravel-search依赖 也相应按说明做了配置,最后写了调用程序,程序如下
<code><?php namespace App\Http\Controllers\Search; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use Mmanos\Search\Search; class Esearch extends Controller { protected $search; public function __construct(Search $search) { $this->search = $search; } public function insert(){ $this->search->insert( "post-1", array( 'title' => 'My title', 'content' => 'The quick brown fox...', 'status' => 'published', ), array( 'created_at' => time(), 'creator_id' => 5, ) ); } public function res(){ $results = Search::search('content', 'fox')->get(); var_dump($results); } }</code>
访问结果如下错误,
小弟水平低,请指点,谢谢!!!
按http://laravelacademy.org/post/3781.html 安装了Elasticsearch(启动后通过curl -X GET http://localhost:9200 测试正常返回信息) 及mmanos/laravel-search依赖 也相应按说明做了配置,最后写了调用程序,程序如下
<code><?php namespace App\Http\Controllers\Search; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use Mmanos\Search\Search; class Esearch extends Controller { protected $search; public function __construct(Search $search) { $this->search = $search; } public function insert(){ $this->search->insert( "post-1", array( 'title' => 'My title', 'content' => 'The quick brown fox...', 'status' => 'published', ), array( 'created_at' => time(), 'creator_id' => 5, ) ); } public function res(){ $results = Search::search('content', 'fox')->get(); var_dump($results); } }</code>
访问结果如下错误,
小弟水平低,请指点,谢谢!!!
你看看下面的评论,目前第一条就是了。
学院君回复是:
有安装elasticsearch依赖组件吗