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

怎么查询网站是哪家公司做的凤凰网全国疫情实时动态

怎么查询网站是哪家公司做的,凤凰网全国疫情实时动态,主要网站 开发语言,郴州建设局门户网站写在前面 通过completion suggester可以实现如下的效果: 其实就是做的like xxx%这种。通过FST这种数据结构来存储,实现快速的前缀匹配,并且可以将es所有的数据加载到内存中所以速度completion的查询速度非常快。 需要注意,如果…

写在前面

通过completion suggester可以实现如下的效果:
在这里插入图片描述
其实就是做的like xxx%这种。通过FST这种数据结构来存储,实现快速的前缀匹配,并且可以将es所有的数据加载到内存中所以速度completion的查询速度非常快。

需要注意,如果是某个字段想要使用completion suggester的功能,需要将其类型设置为completion,也就是我们需要显示的设置mapping来指定。

1:例子

首先来创建索引并指定mapping:

DELETE articlesPUT articles
{"mappings": {"properties": {"title": {"type": "text","fields": {"title_use_completion": {"type": "completion"}}}}}
}

接着插入数据:

POST articles/_bulk
{ "index": {} }
{ "title": "lucene is very cool" }
{ "index": {} }
{ "title": "Elasticsearch builds on top of lucene" }
{ "index": {} }
{ "title": "Elasticsearch rocks" }
{ "index": {} }
{ "title": "elastic is the company behind ELK stack" }
{ "index": {} }
{ "title": "Elk stack rocks" }

查询:

POST articles/_search 
{"size": 0,"suggest": {"article-suggester": {"prefix": "luc","completion": {"field": "title.title_use_completion"}}}
}

在这里插入图片描述
另外,es还支持一种基于上下文的suggestion,Context Suggerter,如下:
在这里插入图片描述
context分为两类,category和geo,如下:
在这里插入图片描述

以context为里来看下。

  • 首先来定义mapping
    在mapping中指定context的信息:
# 删除
DELETE comments
# 创建
PUT comments
# 指定mapping
PUT comments/_mapping
{"properties": {"comment_autocomplete": {"type": "completion","contexts": [{"type": "category","name": "comment_category"}]}}
}

数据:

# 录入数据并指定上下文是movies
POST comments/_doc
{"comment": "I love the star war movies","comment_autocomplete": {"input": ["start wars"],"contexts": {"comment_category": "movies"}}
}# 录入数据并指定上下文是coffee
POST comments/_doc
{"comment": "Where can I find a Starbucks","comment_autocomplete": {"input": ["starbucks"],"contexts": {"comment_category": "coffee"}}
}

movies上下文查询:

# 如果是movie上下文,返回start wars
POST comments/_search
{"suggest": {"MY_SUGGESTION": {"prefix": "sta","completion": {"field": "comment_autocomplete","contexts": {"comment_category": "movies"}}}}
}

在这里插入图片描述
coffee上下文查询:

# 如果是coffee上下文,返回starbucks
POST comments/_search
{"suggest": {"MY_SUGGESTION": {"prefix": "sta","completion": {"field": "comment_autocomplete","contexts": {"comment_category": "coffee"}}}}
}

在这里插入图片描述

最后看下term,phrase,completion三者的对比:
在这里插入图片描述

写在后面

参考文章列表

倒排索引:ES倒排索引底层原理及FST算法的实现过程 。

http://www.shuangfujiaoyu.com/news/33265.html

相关文章:

  • 新华区设计网站公司做seo必须有网站吗
  • 津南天津网站建设网站seo规划
  • 网站做裂变引流网站建设主要推广方式
  • 贵阳做网站的公司搜索引擎优化的具体措施
  • 不备案网站推广文章的推广渠道
  • 官网的网站开发费用yande搜索引擎官网入口
  • 唐山做网站建设公司长沙网红奶茶
  • 哪个网站做外贸年费比较便宜百度小说app
  • 网站主体注销seo外链
  • 重庆做网站电话北京百度网讯科技有限公司
  • it行业培训机构一般多少钱seo网站外包公司
  • 网站可以做无形资产青岛seo公司
  • 视频聊天室网站开发武汉seo收费
  • 做注册任务赚钱的网站电商网站开发平台
  • 黄石网站建外链发布工具
  • 去除 做网站就用建站之星软文台
  • 广州专门做网站的公司北京网站优化培训
  • 网站免费建站叉手谷歌seo网站运营
  • 网站建设手机端官网朝阳seo建站
  • 做旅游宣传图的网站有哪些软文范例大全1000字
  • 广州网站建设大公司seo简单优化
  • 江门网站制作维护网站模板免费下载
  • 微商怎么引流被别人加app排名优化
  • 做网站怎么导入源码郑州网站建设推广
  • 外贸网站建设维护手机流畅优化软件
  • 北京建设执业网站平台推广费用
  • 上饶网站建设企业外包公司的优势和劣势
  • 简洁中文网站模板下载网络销售新手入门
  • 建设银行租房网站建立免费个人网站
  • 专业的网站首页建设公司seo网站优化软件价格