ElasticSearch Snowball token filter

2020-09-27 15:15:00 浏览数 (1)

Snowball token filter

使用除梗器,对单词进行除梗的过滤器。语言参数可以控制除梗器,有如下的语言可供选择: Armenian, Basque, Catalan, Danish, Dutch, English, Finnish, French, German, German2, Hungarian, Italian, Kp, Lithuanian, Lovins, Norwegian, Porter, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish.

例如:

代码语言:javascript复制
PUT /my_index
{
    "settings": {
        "analysis" : {
            "analyzer" : {
                "my_analyzer" : {
                    "tokenizer" : "standard",
                    "filter" : ["lowercase", "my_snow"]
                }
            },
            "filter" : {
                "my_snow" : {
                    "type" : "snowball",
                    "language" : "Lovins"
                }
            }
        }
    }
}

snowball token filter ,它可以把 sing/ sings / singing 都转化词干 sing。不管用户搜 sing、sings、singing, 他的搜索结果都是基于「sing」这个term,所得的结果集都一样。

0 人点赞