ArticleCase missing from nest elision filter?

2019-08-19 09:02发布

According to this page, the french analyzer is defined with a case-insensitive elision step like so:

...
"french_elision": {
  "type": "elision",
  "articles_case": true,  // <==== Note this article case property
  "articles": [
    "l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu"
  ]
},
...

In trying to recreate this in NEST (v6.6), I seem to have hit a snag in that the ArticleCase call doesn't seem to exist. Is is just missing as a bug? Or is there another way this is supposed to be done?

.Elision("french_elision", f => f
  // .ArticlesCase(true) <==== Doesn't exist
  .Articles("l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu"))

I also looked around for a bool on Articles() or something, but I can't find it. I went ahead and ran the code, and the value is not set by default. How do I make sure the elision filter has this value set? Thanks

1条回答
贼婆χ
2楼-- · 2019-08-19 09:31

As can be seen here: https://github.com/elastic/elasticsearch-net/issues/3570

russcam says the following:

This is missing. We'll add it into the next release.

In the meantime, you can add it by deriving from ElisionTokenFilter and add the property e.g.

public class MyElisionTokenFilter : ElisionTokenFilter 
{
    [PropertyName("articles_case")]
    public bool? ArticlesCase { get; set; }
}

and use this in your settings using

.UserDefined("french_elision", new MyElisionTokenFilter
{
    ArticlesCase = true,
    Articles = new[] { "l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu" }
})
查看更多
登录 后发表回答