'How to avoid @search.score from Azure Search result?
How to avoid @search.score from Azure Search result?
When I execute
var searchOptions = new SearchOptions
{
Select = { "id" },
};
await _searchClient.SearchAsync<object>("*", searchOptions);
each record returned has a property called @search.score
Is there a way to avoid it? I only need the id
.
Solution 1:[1]
Based on the information provided here
, I would say it is not possible to omit @search.score
.
"@search.score": document_score (if a text query was provided)
Just thinking out loud, one possible way would be to have your search result return a typed model instead of a generic object. So you could create a class called MyDocument
that has one public property called id
.
When you do something like:
await _searchClient.SearchAsync<MyDocument>("*", searchOptions);
You will get a collection of MyDocument
objects which will only have id
property.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gaurav Mantri |