代码之家  ›  专栏  ›  技术社区  ›  Shachaf.Gortler

停止字分析器,停止字路径未按预期工作

  •  0
  • Shachaf.Gortler  · 技术社区  · 8 年前

    我在ES2.3上,我有一个stop words文件的列表,它是大写和小写的混合 我正在尝试创建一个忽略了停止字大小写的分析器

     "stopword_analyzer": {
          "type": "standard",
          "ignore_case": "true"
          "stopwords_path": "stopwords_english.txt"
        }
    

    我试过在上面用一个单独的停止字来检查停止字是否有问题

        "stopword_analyzer6": {
          "type": "stop",
          "stopwords": "[UPPERCASE]",
          "ignore_case": "true"
        }
    

    但这也失败了

    我也试过用小写的过滤器,但效果不太好

        "stopword_analyzer5": {
          "type": "stop",
          "stopwords_path": "stopwords_english.txt",
          "filter": [
            "lowercase"
          ]
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   Shachaf.Gortler    8 年前

    我最后做的就是在自定义分析器上使用一个小写的stop word过滤器

    "analysis": {
          "filter": {
            "my_stop":{
              "type": "stop",
              "ignore_case": "true",
              "stopwords_path": "stopwords_english.txt"
            }
          },
          "analyzer": {
            "stopword_analyzer7": {
              "type": "custom",
              "tokenizer": "whitespace",
              "stopwords_path": "stopwords_english.txt",
              "filter": [
                "lowercase",
                "my_stop"
              ]
            }
          }
        }
    
    推荐文章