我如何将停止过滤器...与stopword_path一起使用? 我可以在 postman 中使用停止过滤器
这是我的代码。
"analysis" : {
"analyzer" : {
"ilhee_Custom" : {
"type": "custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "my_stoplist"]
}
},
"filter" : {
"my_stoplist" : {
"type" : "stop",
"stopwords_path" : "stopword_list.txt",
"remove_trailing" : true
}
}
}
}
我找到答案了!!是吗?
var stoplist = new StopTokenFilterDescriptor();
stoplist.StopWordsPath(@"\stopword_list.txt");
var createIndexResponse = client.CreateIndex("ilhee", c => c
.Settings(s => s
.Analysis(a => a
.Analyzers(ad => ad
// give the custom analyzer a name
.Custom("ilhee_Custom", ca => ca
.Tokenizer("standard")
.Filters("lowercase", "stop", "standard", "snowball","my_stoplist")
)
)
.TokenFilters(s1=>s1
.UserDefined("my_stoplist",stoplist))
)
)
);
最佳答案
那会起作用的。您还可以使用 TokenFiltersDescriptor
Stop()
方法
var createIndexResponse = client.CreateIndex("ilhee", c => c
.Settings(s => s
.Analysis(a => a
.Analyzers(ad => ad
// give the custom analyzer a name
.Custom("ilhee_Custom", ca => ca
.Tokenizer("standard")
.Filters("lowercase", "stop", "standard", "snowball", "my_stoplist")
)
)
.TokenFilters(s1 => s1
.Stop("my_stoplist", tf => tf
.StopWordsPath("stopword_list.txt")
)
)
)
)
);
关于nest - 在 Elasticsearch.net、Nest 上使用 Stop Filter 和 stopword_path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37915092/