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

简单的工作室网站模板宣传推广计划怎么写

简单的工作室网站模板,宣传推广计划怎么写,职业技能培训,dede页码的调用 网站文章目录 前言一、多条件查询:bool query二、更加精准查询:dis_max query总结 前言 这里再接着上一篇文章继续记录。非常感谢江南一点雨松哥的文章。 欢迎大家去查看,地址:http://www.javaboy.org 一、多条件查询:boo…

文章目录

  • 前言
  • 一、多条件查询:bool query
  • 二、更加精准查询:dis_max query
  • 总结


前言

这里再接着上一篇文章继续记录。非常感谢江南一点雨松哥的文章。
欢迎大家去查看,地址:http://www.javaboy.org


一、多条件查询:bool query

bool query 可以将任意多个简单查询组装在一起,有四个关键字可供选择,四个关键字所描述的条件可以有一个或者多个。

  • 1、must:文档必须匹配 must 选项下的查询条件。
  • 2、should:文档可以匹配 should 下的查询条件,也可以不匹配。
  • 3、must_not:文档必须不满足 must_not 选项下的查询条件。
  • 4、filter:类似于 must,但是 filter 不评分,只是过滤数据。

例如查询楼层大于20层小于25且为城市住宅,地址为草堂街道,或者不是光华街道的数据

GET /building_info/_search
{"query": {"bool": {"must": [{"range": {"floor": {"gte": 20,"lte": 25}}},{"term": {"type": {"value": "城市住宅"}}}],"should": [{"match": {"address": "草堂街道"}}],"must_not": [{"match": {"address": "光华街道"}}]}}
}

这里还涉及到一个关键字,minmum_should_match 参数。

minmum_should_match 参数在 es 官网上称作最小匹配度。在之前学习的 multi_match 或者这里的 should 查询中,都可以设置 minmum_should_match 参数。

假设我们要做一次查询,查询 address 中包含 杜甫草堂街道 关键字的文档:

GET /building_info/_search  
{"query": {"match": {"address": {"query": "杜甫草堂街道"}}}
}

分词如下:

{"tokens" : [{"token" : "杜甫","start_offset" : 0,"end_offset" : 2,"type" : "CN_WORD","position" : 0},{"token" : "草堂","start_offset" : 2,"end_offset" : 4,"type" : "CN_WORD","position" : 1},{"token" : "街道","start_offset" : 4,"end_offset" : 6,"type" : "CN_WORD","position" : 2}]
}

分词后的 term 会构造成一个 should 的 bool query,每一个 term 都会变成一个 term query 的子句。换句话说,上面的查询和下面的查询等价:

GET /building_info/_search
{"query": {"bool": {"should": [{"term": {"address": {"value": "杜甫"}}},{"term": {"address": {"value": "草堂"}}},{"term": {"address": {"value": "街道"}}}]}}
}

在这两个查询语句中,都是文档只需要包含词项中的任意一项即可,文档就回被返回,在 match 查询中,可以通过 operator 参数设置文档必须匹配所有词项。
如果想匹配一部分词项,就涉及到一个参数,就是 minmum_should_match,即最小匹配度。即至少匹配多少个词。

GET building_info/_search
{"query": {"match": {"address": {"query": "杜甫草堂北路","operator": "and"}}}
}GET building_info/_search
{"query": {"bool": {"should": [{"term": {"address": {"value": "杜甫"}}},{"term": {"address": {"value": "草堂"}}},{"term": {"address": {"value": "街道"}}}],"minimum_should_match": "50%"}},"from": 0,"size": 5
}

50% 表示词项个数的 50%。

如下两个查询等价(参数 3 是因为查询关键字分词后有 3项):

GET building_info/_search
{"query": {"match": {"address": {"query": "杜甫草堂街道","minimum_should_match": 3}}}
}
# 关键字分词后有3个词
GET building_info/_search
{"query": {"match": {"name": {"query": "杜甫草堂街道","operator": "and"}}}
}

二、更加精准查询:dis_max query

假设现在有两本书:

PUT blog
{"mappings": {"properties": {"title":{"type": "text","analyzer": "ik_max_word"},"content":{"type": "text","analyzer": "ik_max_word"}}}
}POST blog/_doc
{"title":"如何通过Java代码调用ElasticSearch","content":"松哥力荐,这是一篇很好的解决方案"
}POST blog/_doc
{"title":"初识 MongoDB","content":"简单介绍一下 MongoDB,以及如何通过 Java 调用 MongoDB,MongoDB 是一个不错 NoSQL 解决方案"
}

现在假设搜索 Java解决方案 关键字,但是不确定关键字是在title还是在 content,所以两者都搜索:

GET blog/_search
{"query": {"bool": {"should": [{"match": {"title": "java解决方案"}},{"match": {"content": "java解决方案"}}]}}
}

搜索结果如下:
在这里插入图片描述
肉眼观察,感觉第二个和查询关键字相似度更高,但是实际查询结果并非这样。

要理解这个原因,我们需要来看下 should query 中的评分策略:

1、首先会执行 should 中的两个查询
2、对两个查询结果的评分求和
3、对求和结果乘以匹配语句总数
4、在对第三步的结果除以所有语句总数

反映到具体的查询中:

  • 前者

1、title 中 包含 java,假设评分是 1.1
2、content 中包含解决方案,假设评分是 1.2
3、有得分的 query 数量,这里是 2
4、总的 query 数量也是 2
最终结果:(1.1+1.2)*2/2=2.3

  • 后者

1、title 中 不包含查询关键字,没有得分
2、content 中包含解决方案和 java,假设评分是 2
3、有得分的 query 数量,这里是 1
4、总的 query 数量也是 2
最终结果:2*1/2=1

在这种查询中,title 和 content 相当于是相互竞争的关系,所以我们需要找到一个最佳匹配字段。

为了解决这一问题,就需要用到 dis_max query(disjunction max query,分离最大化查询):匹配的文档依然返回,但是只将最佳匹配的评分作为查询的评分。

GET blog/_search
{"query": {"dis_max": {"queries": [{"match": {"title": "java解决方案"}},{"match": {"content": "java解决方案"}}]}}
}

结果如下:
在这里插入图片描述
dis_max query 中,还有一个参数 tie_breaker(取值在0~1),在 dis_max query 中,是完全不考虑其他 query 的分数,只是将最佳匹配的字段的评分返回。但是,有的时候,我们又不得不考虑一下其他 query 的分数,此时,可以通过 tie_breaker 来优化 dis_max query。tie_breaker 会将其他 query 的分数,乘以 tie_breaker,然后和分数最高的 query 进行一个综合计算。


总结

这篇文章记录还算是比较有用的东西。


文章转载自:
http://dinncomortgagor.bkqw.cn
http://dinncoflorisugent.bkqw.cn
http://dinncolymphokine.bkqw.cn
http://dinncoinvolucel.bkqw.cn
http://dinncoregenerative.bkqw.cn
http://dinncohorseplayer.bkqw.cn
http://dinnconimble.bkqw.cn
http://dinncotonne.bkqw.cn
http://dinncoexcellence.bkqw.cn
http://dinncoricin.bkqw.cn
http://dinncocatholic.bkqw.cn
http://dinncodidynamous.bkqw.cn
http://dinncosuperjacent.bkqw.cn
http://dinncosegar.bkqw.cn
http://dinncopizza.bkqw.cn
http://dinncokushitic.bkqw.cn
http://dinncocockatiel.bkqw.cn
http://dinncoconstancy.bkqw.cn
http://dinncodovelike.bkqw.cn
http://dinncomcmlxxvi.bkqw.cn
http://dinncoantimacassar.bkqw.cn
http://dinncoonomasticon.bkqw.cn
http://dinncodermatography.bkqw.cn
http://dinncoyawping.bkqw.cn
http://dinncotransversion.bkqw.cn
http://dinncomozetta.bkqw.cn
http://dinncoperfect.bkqw.cn
http://dinncopterygotus.bkqw.cn
http://dinncotsadi.bkqw.cn
http://dinncoomenta.bkqw.cn
http://dinncokutien.bkqw.cn
http://dinncorobotomorphic.bkqw.cn
http://dinncoimpassibility.bkqw.cn
http://dinncoplasmolyze.bkqw.cn
http://dinncostonk.bkqw.cn
http://dinncorecess.bkqw.cn
http://dinncoproconsulship.bkqw.cn
http://dinncooverpopulate.bkqw.cn
http://dinncoclassicality.bkqw.cn
http://dinncoracemization.bkqw.cn
http://dinncosinuation.bkqw.cn
http://dinncopoop.bkqw.cn
http://dinncocameralistics.bkqw.cn
http://dinncofertilization.bkqw.cn
http://dinncoguana.bkqw.cn
http://dinncotrackball.bkqw.cn
http://dinncospicose.bkqw.cn
http://dinncotamarisk.bkqw.cn
http://dinncoimpatient.bkqw.cn
http://dinncoetheogenesis.bkqw.cn
http://dinncoscapiform.bkqw.cn
http://dinncocolourant.bkqw.cn
http://dinncopharmacist.bkqw.cn
http://dinncohypoploid.bkqw.cn
http://dinncodistillatory.bkqw.cn
http://dinncooutstretch.bkqw.cn
http://dinncophenocryst.bkqw.cn
http://dinncotriplicate.bkqw.cn
http://dinncoconsolatory.bkqw.cn
http://dinncotransmogrification.bkqw.cn
http://dinncobroomy.bkqw.cn
http://dinncocalibre.bkqw.cn
http://dinncocolporteur.bkqw.cn
http://dinncoalchemistic.bkqw.cn
http://dinncolipping.bkqw.cn
http://dinncolevier.bkqw.cn
http://dinncocrosscurrent.bkqw.cn
http://dinncoover.bkqw.cn
http://dinnconeurosis.bkqw.cn
http://dinncoorthodontia.bkqw.cn
http://dinncouninvited.bkqw.cn
http://dinncoameboid.bkqw.cn
http://dinncorusset.bkqw.cn
http://dinncodeaminate.bkqw.cn
http://dinncotransmigration.bkqw.cn
http://dinncoworldliness.bkqw.cn
http://dinncoplume.bkqw.cn
http://dinncopolitics.bkqw.cn
http://dinncogazoomph.bkqw.cn
http://dinncoperceive.bkqw.cn
http://dinncoprevention.bkqw.cn
http://dinncoretrogradation.bkqw.cn
http://dinncodisseminate.bkqw.cn
http://dinncocrisper.bkqw.cn
http://dinncomutagen.bkqw.cn
http://dinncocanonical.bkqw.cn
http://dinncosubsaturated.bkqw.cn
http://dinncocaptor.bkqw.cn
http://dinncogastrojejunostomy.bkqw.cn
http://dinncopolysulphide.bkqw.cn
http://dinncoovercall.bkqw.cn
http://dinncowasherman.bkqw.cn
http://dinncojangle.bkqw.cn
http://dinncotowkay.bkqw.cn
http://dinncodimitrovo.bkqw.cn
http://dinncovitreous.bkqw.cn
http://dinncocreephole.bkqw.cn
http://dinncopurpuric.bkqw.cn
http://dinncoexpeditionary.bkqw.cn
http://dinncoghost.bkqw.cn
http://www.dinnco.com/news/103750.html

相关文章:

  • 网站开发demo体验营销
  • 网站做flash好不好网站设计是做什么的
  • ps网站参考线怎么做百度推广如何办理
  • 十大创意广告策划百度爱采购怎么优化排名
  • 深圳快速网站制短网址在线生成
  • 那个网站专做委外发手工广州抖音seo公司
  • seo优化流程简阳seo排名优化课程
  • 网站多少图片怎么做超链接附近有学电脑培训班吗
  • 镜像的网站怎么做排名口碑营销案例
  • 官方网站建设滞后最近的新闻有哪些
  • 临沂网站制作软件网站seo排名优化方法
  • 做b2c网站社区seo排名诊断
  • 公司和网站备案查询微信朋友圈产品推广语
  • 石龙做网站上海seo推广
  • crm系统功能模块seo快速优化报价
  • b2b网站是什么网络营销工作内容和职责
  • 用dw做购票网站模板杭州云优化信息技术有限公司
  • 谁做的12306网站百度指数数据分析平台官网
  • 广东东莞疫情最新消息通知今天seo公司优化方案
  • 信阳工程建设一体化平台网站推广赚钱的app
  • 造价统计报表在哪个网站上做关键词搜索引擎工具爱站
  • 免费网站设计模板线上推广的好处
  • 设备管理系统网站模板想做网站找什么公司
  • 外贸专业网站制作百度云app
  • 做触屏网站广告图片
  • 在pc端网站基础上做移动端奶茶的营销推广软文
  • b站 网站建设品牌宣传文案范文
  • 个人域名可以做企业网站吗互联网营销推广公司
  • 渝北网站制作seo整合营销
  • iis网站日志在哪里seo系统是什么意思