我正在使用弹性,我对我的搜索相关性非常满意,除了一个ocassion。例如,如果我正在寻找世界"玩"我将获得包含wold" play"得分高于这些单词" play"。这是因为我在使用带有Fuzziness.Auto(在搜索上)的edgeNgrams(在索引上)。是否有任何过滤器或方法来提升精确的模糊的?
以下是索引编码
var response = client.CreateIndex(index, s => s
.Settings(s1 => s1.NumberOfShards(1).NumberOfReplicas(1)
.Analysis(a => a.TokenFilters(t => t.EdgeNGram("edge", ed => ed.MaxGram(50).MinGram(1).Side(EdgeNGramSide.Front))
.Lowercase("lowercase", gl => gl.Language(Language.Greek.ToString())).KeywordMarker("keywords", gk => gk.Keywords("")))
.Analyzers(a1 => a1.Custom("forindex", t => t.Tokenizer("standard")
.Filters("edge", "lowercase", "keywords" ))
.Custom("forsearch", cu => cu.Tokenizer("standard")
.Filters("lowercase", "keywords"))))));
在这里搜索
var query = new MatchQuery()
{
Query = searchWord,
Operator = Operator.And,
Field = fieldName,
Fuzziness = Fuzziness.Auto,
PrefixLength = 1,
Analyzer = "forsearch"
};