Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 同义词过滤器的不同位置增量行为_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Search_Lucene - Fatal编程技术网 elasticsearch 同义词过滤器的不同位置增量行为,elasticsearch,search,lucene,elasticsearch,Search,Lucene" /> elasticsearch 同义词过滤器的不同位置增量行为,elasticsearch,search,lucene,elasticsearch,Search,Lucene" />

elasticsearch 同义词过滤器的不同位置增量行为

elasticsearch 同义词过滤器的不同位置增量行为,elasticsearch,search,lucene,elasticsearch,Search,Lucene,我的用例是搜索带有同义词的edge\ngram支持,其中要匹配的标记应按顺序排列 在尝试分析时,我观察到过滤器链在位置增量方面的两种不同行为 当筛选链为小写时,同义词由于同义词筛选 过滤器链为小写、边缘、同义词时,由于同义词过滤器 以下是我针对每个案例运行的查询: 案例1。无职位增加 PUT synonym_test { "index": { "analysis": { "analyzer": {

我的用例是搜索带有同义词的
edge\ngram
支持,其中要匹配的标记应按顺序排列

在尝试分析时,我观察到过滤器链在位置增量方面的两种不同行为

  • 当筛选链为
    小写时,同义词
    由于
    同义词筛选
  • 过滤器链为
    小写、边缘、同义词
    时,由于
    同义词过滤器
  • 以下是我针对每个案例运行的查询:

    案例1。无职位增加

    PUT synonym_test
    {
      "index": {
        "analysis": {
          "analyzer": {
            "by_smart": {
              "type": "custom",
              "tokenizer": "whitespace",
              "filter": [
                "lowercase",
                "custom_synonym"
              ]
            }
          },
          "filter": {
            "custom_synonym": {
              "type": "synonym",
              "synonyms": [
                "begin => start"
              ]
            }
          }
        }
      }
    }
    
    
    GET synonym_test/_analyze
    {
      "text": "begin working",
      "analyzer": "by_smart"
    }
    
    
    PUT synonym_test
    {
      "index": {
        "analysis": {
          "analyzer": {
            "by_smart": {
              "type": "custom",
              "tokenizer": "whitespace",
              "filter": [
                "lowercase",
                "custom_edge_ngram",
                "custom_synonym"
              ]
            }
          },
          "filter": {
            "custom_synonym": {
              "type": "synonym",
              "synonyms": [
                "begin => start"
              ]
            },
            "custom_edge_ngram": {
              "type": "edge_ngram",
              "min_gram": "2",
              "max_gram": "60"
            }
          }
        }
      }
    }
    
    GET synonym_test/_analyze
    {
      "text": "begin working",
      "analyzer": "by_smart"
    }
    
    产出:


    案例2。职位增量

    PUT synonym_test
    {
      "index": {
        "analysis": {
          "analyzer": {
            "by_smart": {
              "type": "custom",
              "tokenizer": "whitespace",
              "filter": [
                "lowercase",
                "custom_synonym"
              ]
            }
          },
          "filter": {
            "custom_synonym": {
              "type": "synonym",
              "synonyms": [
                "begin => start"
              ]
            }
          }
        }
      }
    }
    
    
    GET synonym_test/_analyze
    {
      "text": "begin working",
      "analyzer": "by_smart"
    }
    
    
    PUT synonym_test
    {
      "index": {
        "analysis": {
          "analyzer": {
            "by_smart": {
              "type": "custom",
              "tokenizer": "whitespace",
              "filter": [
                "lowercase",
                "custom_edge_ngram",
                "custom_synonym"
              ]
            }
          },
          "filter": {
            "custom_synonym": {
              "type": "synonym",
              "synonyms": [
                "begin => start"
              ]
            },
            "custom_edge_ngram": {
              "type": "edge_ngram",
              "min_gram": "2",
              "max_gram": "60"
            }
          }
        }
      }
    }
    
    GET synonym_test/_analyze
    {
      "text": "begin working",
      "analyzer": "by_smart"
    }
    
    产出:

    请注意,在案例1中,标记
    begin
    start
    在被替换时具有相同的位置,并且没有位置增量。然而,在情况2中,当
    start
    令牌被
    start
    替换时,后续令牌流的位置增加


    下面是我的问题:

  • 为什么它不发生在案例1中,而只发生在案例2中
  • 这导致的主要问题是,当输入查询是
    begi-wor
    match_-phrase
    查询(默认
    slop
    0
    )时,它与
    开始工作
    不匹配。 这是因为
    begi
    wor
    相隔两个位置。关于如何在不影响用例的情况下实现这种行为,有什么建议吗
  • 我使用的是ElasticSearch版本
    5.6.8
    的lucene版本
    6.6.1

    我已经阅读了一些文档链接和文章,但我找不到任何合适的链接来解释为什么会发生这种情况,是否有一些设置来实现我想要的行为