我尝试从我的搜索中获得高亮显示,但是结果没有突出显示。
我正在使用这个插件:http://book.cakephp.org/3.0/en/elasticsearch.html#searching-indexed-documents
我的代码:
public function pesquisaIndice($searchText = null){
$this->loadModel('BooksI', 'Elastic');
$query = $this->BooksI->find()->limit(100)->highlight(['fields'=> ['number_of_fragments'=>20]]);
$query->where(function ($builder) {
return $builder->query(
[
'query_string' =>
[
'query'=> ' melhor',
'default_operator' =>'and'
],
]
);
});
var_dump($query);
}发布于 2015-10-20 16:07:28
在命令行我可以..。但是有了这个插件我不能
curl -XGET "http://localhost:9200/my_apps_index/_search?pretty=true" -d '{
"query": {
"query_string": {
"query": "melhor"
}
},
"highlight": {
"pre_tags": ["<b>"],
"post_tags": ["</b>"],
"fields": {
"content": {"number_of_fragments": 20}
}
}
}'https://stackoverflow.com/questions/33239364
复制相似问题