当前位置: 首页 > news >正文

做网站弄什么语言上海市网站建设

做网站弄什么语言,上海市网站建设,网站运营与建设,美文分享网站源码背景#xff1a; IK分词提供的两个分词器#xff0c;并不支持一些新的词汇#xff0c;有时候也不能满足实际业务需要#xff0c;这时候#xff0c;我们可以定义自定义词库来完成目标。 目标#xff1a; 定制化中文分词器#xff0c;使得我们的中文分词器支持扩展的词汇 … 背景 IK分词提供的两个分词器并不支持一些新的词汇有时候也不能满足实际业务需要这时候我们可以定义自定义词库来完成目标。 目标 定制化中文分词器使得我们的中文分词器支持扩展的词汇 文章目录一、搜索现状1. 搜索关键词2. 数据结果3. 数据分析4. ES IK分词5. IK分词结果分析二、定制化分词器2.1. 新增分词词典库2.2. 词典配置2.3. 重启es72.4. 重新查看分词结果2.5. 重新搜索2.6. 重建分词索引2.7. 再次查询2.8. 数据分析一、搜索现状 1. 搜索关键词 # 搜索凯悦相关的酒店 GET /shop/_search {query:{match: {name:凯悦}} }2. 数据结果 {took : 7,timed_out : false,_shards : {total : 1,successful : 1,skipped : 0,failed : 0},hits : {total : {value : 5,relation : eq},max_score : 3.3362136,hits : [{_index : shop,_type : _doc,_id : 9,_score : 3.3362136,_source : {price_per_man : 176,remark_score : 2.2,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.916Z,tags : 落地大窗,location : 31.306172,121.525843,seller_remark_score : 3.0,id : 9,name : 凯悦酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 10,_score : 2.836244,_source : {price_per_man : 182,remark_score : 0.5,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.918Z,tags : 自助餐,location : 31.196742,121.322846,seller_remark_score : 3.0,id : 10,name : 凯悦嘉轩酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 11,_score : 2.836244,_source : {price_per_man : 74,remark_score : 1.0,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.920Z,tags : 自助餐,location : 31.156899,121.238362,seller_remark_score : 3.0,id : 11,name : 新虹桥凯悦酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 12,_score : 2.638537,_source : {price_per_man : 71,remark_score : 2.0,category_name : 美食2,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.923Z,tags : 有包厢,location : 30.679819,121.651921,seller_remark_score : 3.0,id : 12,name : 凯悦咖啡(新建西路店),seller_id : 17,category_id : 1}},{_index : shop,_type : _doc,_id : 4,_score : 1.3119392,_source : {price_per_man : 152,remark_score : 2.0,category_name : 美食2,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.907Z,tags : 落地大窗 有WIFI,location : 31.306419,121.524878,seller_remark_score : 2.0,id : 4,name : 花悦庭果木烤鸭,seller_id : 2,category_id : 1}}]} }3. 数据分析 上面数据中有一条不符的结果数据此数据中无**“凯悦”**关键词但是搜索后还是显示在页面上不符合预期搜索结果。 {_index : shop,_type : _doc,_id : 4,_score : 1.3119392,_source : {price_per_man : 152,remark_score : 2.0,category_name : 美食2,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.907Z,tags : 落地大窗 有WIFI,location : 31.306419,121.524878,seller_remark_score : 2.0,id : 4,name : 花悦庭果木烤鸭,seller_id : 2,category_id : 1}}4. ES IK分词 # 查阅凯悦分词 GET /shop/_analyze {analyzer: ik_smart,text: 凯悦 }5. IK分词结果分析 {tokens : [{token : 凯,start_offset : 0,end_offset : 1,type : CN_CHAR,position : 0},{token : 悦,start_offset : 1,end_offset : 2,type : CN_CHAR,position : 1}] }从上面数据可以看出使用ik_smart分词api分词“凯”“悦”并没有将“凯悦”关键词当做一个分词元素主要原因就是es安装的ik中文分词库中没有将“凯悦”放入分词库。 二、定制化分词器 2.1. 新增分词词典库 cd /app/elasticsearch-7.15.2/config/analysis-ik/ vim new_word.dic添加自定义分词 凯悦2.2. 词典配置 使用ik加载我们自定义的分词词典库 vim IKAnalyzer.cfg.xml内容 ?xml version1.0 encodingUTF-8? !DOCTYPE properties SYSTEM http://java.sun.com/dtd/properties.dtd propertiescommentIK Analyzer 扩展配置/comment!--用户可以在这里配置自己的扩展字典 --entry keyext_dictnew_word.dic/entry!--用户可以在这里配置自己的扩展停止词字典--entry keyext_stopwords/entry!--用户可以在这里配置远程扩展字典 --!-- entry keyremote_ext_dictwords_location/entry --!--用户可以在这里配置远程扩展停止词字典--!-- entry keyremote_ext_stopwordswords_location/entry -- /properties2.3. 重启es7 ps -ef|grep elasticsearchkill -9 es进程号cd /app/elasticsearch-7.15.2/ bin/elasticsearch -d2.4. 重新查看分词结果 # 查阅凯悦分词 GET /shop/_analyze {analyzer: ik_smart,text: 凯悦 }GET /shop/_analyze {analyzer: ik_max_word,text: 凯悦 }2.5. 重新搜索 GET /shop/_search {query:{match: {name:凯悦}} }GET /shop/_search发现一条数据都没查询出来但是数据都还在。 2.6. 重建分词索引 索引创建的时候是在ik分词器上当时没有“凯悦”这个词的时候。目前我们凯悦酒店这条记录对应的记录”凯和悦”已经在索引成型单字的”凯”和单字“悦”。因为在擦黄建索引的时候并没有做分词的扩展分词库加载。 目前的问题现在索引中存储的是”凯和悦”分开的但是我搜索的时候执行的凯悦却是按照搜索当前search的分词器也就是分出来的是”凯和悦”连字存在。 我搜索是2个字但是倒排索引的时候是按照单字做搜引得因此导致搜素数据为空。 解决方案 第一种第一次把索引全部删除然后全量同步分词索引 第二种推荐针对搜索的索引中包含“凯“或者“悦“的索引执行重建索引其他的索引不重建索引。 # 重建凯悦分析索引 POST /shop/_update_by_query {query: {bool: {must: [{term:{name:凯}},{term:{name:悦}}]}} }2.7. 再次查询 GET /shop/_search {query:{match: {name:凯悦}} }2.8. 数据分析 {took : 3,timed_out : false,_shards : {total : 1,successful : 1,skipped : 0,failed : 0},hits : {total : {value : 4,relation : eq},max_score : 2.0709352,hits : [{_index : shop,_type : _doc,_id : 9,_score : 2.0709352,_source : {price_per_man : 176,remark_score : 2.2,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.916Z,tags : 落地大窗,location : 31.306172,121.525843,seller_remark_score : 3.0,id : 9,name : 凯悦酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 10,_score : 1.7177677,_source : {price_per_man : 182,remark_score : 0.5,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.918Z,tags : 自助餐,location : 31.196742,121.322846,seller_remark_score : 3.0,id : 10,name : 凯悦嘉轩酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 11,_score : 1.7177677,_source : {price_per_man : 74,remark_score : 1.0,category_name : 酒店,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.920Z,tags : 自助餐,location : 31.156899,121.238362,seller_remark_score : 3.0,id : 11,name : 新虹桥凯悦酒店,seller_id : 17,category_id : 2}},{_index : shop,_type : _doc,_id : 12,_score : 1.5828056,_source : {price_per_man : 71,remark_score : 2.0,category_name : 美食2,version : 1,seller_disabled_flag : 0,timestamp : 2021-11-21T04:10:03.923Z,tags : 有包厢,location : 30.679819,121.651921,seller_remark_score : 3.0,id : 12,name : 凯悦咖啡(新建西路店),seller_id : 17,category_id : 1}}]} }从上面数据可以看出符合预期结果
http://www.pierceye.com/news/405109/

相关文章:

  • 东软集团建设网站娱乐网站排行榜
  • 石家庄网站建站米拓建站官网怎么用不了
  • 推广seo网站的公司金华网站建设公司排名
  • 阿里巴巴网站工作流程网站建设 教学设计
  • 电子商务网站建设的方法怎样用织梦做音乐网站
  • 临夏州住房和城乡建设局网站出词
  • 企业网站的综合要求最新领导班子7人名单
  • 通过阿里云建设企业网站联想企业网站建设的思路
  • 网站建设服务器的选择方案建设报名系统是正规网站吗
  • 揭阳高端模板建站WordPress背景音乐6
  • 如何使用云服务建设网站cpa之家 app推广平台
  • 网站设计策划书案例漳浦建设局网站
  • ps做分享类网站效果图设计公司工作室创业规划
  • 个人虚拟机做网站设计实例网站
  • 衡阳企业网站wordpress置顶文章顺序
  • 网站建设宗旨是指郑州有名的做网页的公司
  • 怎么0成本做网站企业网站如何设计网页
  • 做韦恩图网站课程分销平台
  • html5网站建设中企业整站推广
  • 织梦网站打开速度慢做抢单软件的网站
  • 51单片机可以做网站怎么建设游戏试玩平台网站
  • 汕头网站建设方案维护wordpress百度熊掌
  • 牛街网站建设产品vi设计都包括什么
  • 网站需要多大宽带网站发展的方向
  • 陈光锋网站运营推广新动向故城建设银行网站
  • 备案后网站可以改名吗临颖网站建设
  • 临沭县建设局官方网站怎样做外贸网站推广
  • 手机网站支付一个简单的网页代码带图片
  • 向公司申请请做网站广州网站推广教程
  • 用QQ群做网站排名交互式网站app