gpt4 book ai didi

cakephp - CakePHP 3返回重点 Elasticsearch

转载 作者:行者123 更新时间:2023-12-02 22:40:23 35 4
gpt4 key购买 nike

我尝试从搜索中获取突出显示,但结果没有突出显示

我正在使用此插件: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);


}

最佳答案

在命令行中,我可以...但是使用此插件,我无法

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}
}
}
}'

关于cakephp - CakePHP 3返回重点 Elasticsearch ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33239364/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com