You can return the search score (@search.score) in the response along with the suggested search terms using Azure Cognitive Search Suggest API. Here's how you can do it:
- In the suggest query, add "@search.score" to the "select" parameter to include the search score in the response.
For example:
https://[service name].search.windows.net/indexes/[index name]/docs/suggest?api-version=[api-version]&suggesterName=[suggester name]&search=[user input]&$select=searchText,@search.score
- In the Suggester definition, add "@search.score" to the "sourceFields" parameter to enable scoring of the suggested search terms.
For example:
{ "name": "[suggester name]", "searchMode": "analyzingInfixMatching", "sourceFields": ["[field name 1]", "[field name 2]", "@search.score"] }
No comments:
Post a Comment