【问题标题】:Azure cognitive search suggestion ignoring word order忽略词序的 Azure 认知搜索建议
【发布时间】:2021-11-12 05:13:06
【问题描述】:

假设在我的索引中我有这个值:

Clint Eastwood
Jamie Lee Curtis

我有这个代码简单的代码

public void Search(string indexName, string suggester, string name)
{
    var searchClient = new SearchClient(new Uri(searchServiceEndPoint), indexName , new AzureKeyCredential(adminApiKey));
    
    var so = new SuggestOptions();
    var sugg = searchClient.Suggest<Request>(name, suggester, so);
}

进行以下搜索我得到了这个结果

Working examples:

name = clin
Suggetsion is Clint Eastwood

name = east
Suggestion is Clint Eastwood

name = clint eas
Suggestion is Clint Eastwood
Not working examples

name = eastwood cl
no suggestion

name = jamie curtis
no suggestions

有没有办法让天蓝色搜索不太严格,以便为两个不工作的示例提供建议?

【问题讨论】:

    标签: azure-cognitive-search


    【解决方案1】:

    这是自动完成的常见用例。我的解决方案是在将内容提交到索引之前对其进行令牌轮换。然后,您将根据轮换版本而不是名称提出建议。

    {
    "value": [
        {
            "@search.action": "mergeOrUpload",
            "Id": "1",
            "Name": "Clint Eastwood",
            "Rotated": ["Clint Eastwood", "Eastwood Clint"]
        },
        {
            "@search.action": "mergeOrUpload",
            "Id": "2",
            "Name": "Jamie Lee Curtis",
            "Rotated": ["Jamie Lee Curtis", "Lee Curtis Jamie", "Curtis Jamie Lee"]
        }
    ]
    

    }

    我通常将标记向左旋转,直到像上面那样。请注意,这不能解决您获得jamie curtis 输入建议的要求。但是,您可以通过生成额外的令牌迭代来解决这个问题。

    【讨论】:

      猜你喜欢
      • 2011-04-04
      • 2020-03-27
      • 2021-06-06
      • 2023-01-20
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      相关资源
      最近更新 更多