zoukankan      html  css  js  c++  java
  • 读《深入理解Elasticsearch》点滴-改善查询相关性

    1、标准查询

      query

        match

          _all

            query:"搜索字符串"

            operator:or

    2、多匹配查询+区分权重

      query

        multi_match

          "query":"搜索字符串"

          fields:["title^100","text^10","-all"]        针对字段进行加权

    3、引入短语查询

      query

        bool

          must

            multi_match

          "query":"搜索字符串"

           fields:["title^100","text^10","-all"]        针对字段进行加权

      should

        match_phrase

          title":"搜索字符串"

        match_phrase

          text":"搜索字符串"       连续使用两遍,面向不同字段

    4、引入slop参数

      should

        match_phrase

          title":"搜索字符串"

          slop:1

        match_phrase

          text":"搜索字符串"       连续使用两遍,面向不同字段

          slop:1

    5、扔掉垃圾信息(引入过滤器)

          must_not

            term:

              redirect:true

            term:

              special:true

    6、引入boost(需要使用function_score)

       将match_phrase包装到function_score里面

        ……

        function_score:

          boost_factore:1000,

          query:

            match_phrase

              title:

                 query:"搜索字符串"

                  slot:1

        

  • 相关阅读:
    ADO.NET初学习
    phpstorm+xdeubg debugging 9000 is busy 提示端口不可以的处理办法
    mysql 乐观锁和悲观锁
    Laravel Facade 调用流程源码分析
    利用 反射ReflectionClass来查看里面的属性和方法
    PHP ArrayAccess 接口简单实例
    laravel service provider 简单实例
    从github 下载下来的PHP项目代码本地需要怎么部署
    PHP Closure 类的bind简介和使用
    PHP $this,self,static 的区别
  • 原文地址:https://www.cnblogs.com/jiangtao1218/p/8612618.html
Copyright © 2011-2022 走看看