模糊+邻近搜索弹性搜索和NEST

时间:2020-03-02 17:56:44

标签: c# elasticsearch nest

我正在尝试为查询短语提供语法,例如:

hello world new

还有类似的邻近搜索和排列:

hello .... world
world hello new
new hello world

我还想允许这样的拼写错误:

hello vorld ne

也许这要求太多了?我从这里开始:

scr => scr.Index(indexName)
    .From(0)
    .Size(1000)
    .Query(q => q
    .Match(c => c
        .Field(p => p.Attachment.Content)
        .Query("hello world")
        .Fuzziness(Fuzziness.AutoLength(1, 3))
        .Lenient()
        .FuzzyTranspositions()
        //.MinimumShouldMatch(2)
        .Operator(Operator.And)
        .FuzzyRewrite(MultiTermQueryRewrite.TopTermsBlendedFreqs(10))
    )
)

这已经太敏感了,因为它返回仅包含“世界”的文档,我不完全理解为什么。任何指针注册。以上将不胜感激。谢谢!

0 个答案:

没有答案
相关问题