1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 用elasticsearch-php laravel为什么不能返回高亮数据?

用elasticsearch-php laravel为什么不能返回高亮数据?

时间:2019-09-03 23:45:43

相关推荐

用elasticsearch-php laravel为什么不能返回高亮数据?

后端开发|php教程

laravel,elasticsearch,php

后端开发-php教程

bootstrap源码下载,vscode运行内存需求,深圳ubuntu学习,tomcat怎么在开启,爬虫table class,php new 报错,seo团队绩效考核标准,网站源码怎么下载工具,模板网站有源码么lzw

namespace App\Http\Controllers\Search; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use Elasticsearch\Client;class Index extends Controller{ protected $client; public function __construct(Client $client) { $this->client = $client; } public function search_test(Request $request,$filter=list){ $word = trim($request->input(word)); $s=is_null($request->input(s))?10:trim($request->input(s));//一页多少条 $f=is_null($request->input(f))?1:trim($request->input(f));//当前页数 $fr=($f-1)*$s;//当前页从第一条记录开始 $params=[ index => s_index, ype => s_type, ody => [query => [ ool => [ should => [ [ match => [ itle => $word ] ], [ match => [ description => $word ] ], ] ]],from=>$fr, size=>$s,highlight=>[ fields=>[ itle=>[] ]] ] ]; $response = $this->client->search($params); echo "

"; var_dump($response); echo "

";

菜鸟商城服务端源码,ubuntu gcc 离线,将项目布置到tomcat,爬虫demo下载,php文件打开出现乱码,福建漳州百度seo优化推广lzw

}

}

开源社交网站源码,vscode的换行操作,ubuntu检查网速,tomcat下载路径,安卓中sqlite查询,爬虫需要掌握哪些基础知识,php文件无法解析,单页面站点 seo,qq机器人对接网站数据,易语言 网页教程,织梦演示站点模板lzw

查询结果都能返回,就是无highlight数据,求朋友帮忙!!!

回复内容:

namespace App\Http\Controllers\Search; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use Elasticsearch\Client;class Index extends Controller{ protected $client; public function __construct(Client $client) { $this->client = $client; } public function search_test(Request $request,$filter=list){ $word = trim($request->input(word)); $s=is_null($request->input(s))?10:trim($request->input(s));//一页多少条 $f=is_null($request->input(f))?1:trim($request->input(f));//当前页数 $fr=($f-1)*$s;//当前页从第一条记录开始 $params=[ index => s_index, ype => s_type, ody => [query => [ ool => [ should => [ [ match => [ itle => $word ] ], [ match => [ description => $word ] ], ] ]],from=>$fr, size=>$s,highlight=>[ fields=>[ itle=>[] ]] ] ]; $response = $this->client->search($params); echo "

"; var_dump($response); echo "

";

}

}

查询结果都能返回,就是无highlight数据,求朋友帮忙!!!

暂时没做过搜索服务,感觉高亮的数据应该在控制器里面处理的吧。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。