我如何使用stop filter ...使用stopword_path? 我可以在邮递员中使用停止过滤器
这是我的代码。
"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))
)
)
);
答案 0 :(得分:2)
这将有效。您还可以使用Stop()
TokenFiltersDescriptor
方法
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")
)
)
)
)
);