简体   繁体   English

Azure 认知搜索 - 在搜索结果中检索搜索分数

[英]Azure Cognitive Search - Retrieve Search Score in Search Result

I am looking for a way to retrieve the search score in the search result (an index field value), similar to the other metadata fields like metadata_storage_name or metadata_storage_path.我正在寻找一种在搜索结果(索引字段值)中检索搜索分数的方法,类似于 metadata_storage_name 或 metadata_storage_path 等其他元数据字段。 In the Indexer Definition, I tried retrieving the search score in the following way.在索引器定义中,我尝试通过以下方式检索搜索分数。 Please correct me if I am missing anything or retrieving it the wrong way.如果我遗漏任何东西或以错误的方式检索它,请纠正我。

  "fieldMappings": [    
    {
      "sourceFieldName": "@search.score",
      "targetFieldName": "search_score",
      "mappingFunction": null
    }
  ]

Search score is an attribute added to each search result in the search request response.搜索分数是添加到搜索请求响应中的每个搜索结果的属性。 Try issue a simple search request using your favourite REST client or Azure Poral.尝试使用您最喜欢的 REST 客户端或 Azure Poral 发出简单的搜索请求。 Below is an example of a response object.以下是响应 object 的示例。 @search.score is what you're looking for. @search.score 是您正在寻找的。

"value": [
{
    "@search.score": 7.3617697,
    "HotelId": "21",
    "HotelName": "Nova Hotel & Spa",
    "Description": "1 Mile from the airport.  Free WiFi, Outdoor Pool, Complimentary Airport Shuttle, 6 miles from the beach & 10 miles from downtown.",
    "Category": "Resort and Spa",
    "Tags": [
        "pool",
        "continental breakfast",
        "free parking"
    ]
},
{
    "@search.score": 2.5560288,
    "HotelId": "25",
    "HotelName": "Scottish Inn",
    "Description": "Newly Redesigned Rooms & airport shuttle.  Minutes from the airport, enjoy lakeside amenities, a resort-style pool & stylish new guestrooms with Internet TVs.",
    "Category": "Luxury",
    "Tags": [
        "24-hour front desk service",
        "continental breakfast",
        "free wifi"
    ]
}]

Example is from here: https://docs.microsoft.com/en-us/azure/search/search-query-simple-examples#example-1-full-text-search示例来自此处: https://docs.microsoft.com/en-us/azure/search/search-query-simple-examples#example-1-full-text-search

'@search.score' is not a field in an index, but a computation of each search result relevance scoring. '@search.score' 不是索引中的字段,而是每个搜索结果相关性评分的计算。 If there is a match for the criteria of your search and a result returned, you can retrieve that value from the HTTP response with '@search.score'.如果您的搜索条件匹配并返回结果,您可以使用“@search.score”从 HTTP 响应中检索该值。

Field mappings on the other hand are used to map a field that is found in your data source and does not match the name you would like to use in the index, so you can map to the name you need.另一方面,字段映射用于 map 一个字段,该字段在您的数据源中找到并且与您希望在索引中使用的名称不匹配,因此您可以将 map 设置为您需要的名称。

For more information on the HTTP response of Search Documents REST API and search scoring, please visit: https://docs.microsoft.com/rest/api/searchservice/search-documents and https://docs.microsoft.com/azure/search/index-similarity-and-scoring For more information on the HTTP response of Search Documents REST API and search scoring, please visit: https://docs.microsoft.com/rest/api/searchservice/search-documents and https://docs.microsoft.com/azure /search/index-similarity-and-scoring

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM