Description
Library name and version
Azure.Search.Documents 11.5.1
Describe the bug
We are implementing a search service using vectorized queries with filter in which the only field that is searchable is the one that contains the text embedding. We are able to receive a response for the request, but all the properties return as "null". All the data we need is present in the Non-public members' properties, but they are not retrievable through the GetResultsAsync() method.
Expected behavior
The method GetResultsAsync() should be able to correctly map the raw response content to the properties of the class.
Actual behavior
All properties return as "null", as shown in the image below:
Reproduction Steps
public class AzureSearchDocument
{
public string Id { get; set; }
public string Title { get; set; }
public string Product { get; set; }
public ReadOnlyMemory<float> TextEmbedding { get; set; }
}
class Program
{
static Task Main(string[] args)
{
GetSearchResultsAsync(6, "ProductName", questionEmbedding);
}
public static async Task GetSearchResultsAsync(int maxResults, string product, ReadOnlyMemory<float> questionEmbedding)
{
SearchClient searchClient = new(new Uri("replace with url"), "index-search", new AzureKeyCredential("key"));
SearchResults<AzureSearchDocument> response = await searchClient.SearchAsync<AzureSearchDocument>(
new SearchOptions
{
VectorSearch = new()
{
Queries = { new VectorizedQuery(questionEmbedding) { KNearestNeighborsCount = maxResults, Fields = { "textEmbedding" } } }
},
Filter = $"product eq '{product}'"
});
int count = 0;
await foreach (SearchResult<AzureSearchDocument> result in response.GetResultsAsync())
{
count++;
AzureSearchDocument doc = result.Document;
Console.WriteLine($"[AzureSearchDocument] {doc.Id}: {doc.Title}");
}
Console.WriteLine($"Total number of search results:{count}");
}
}
Here is the configuration of the Index:
Environment
-
.NET SDK:
Version: 8.0.101
Commit: 6eceda187b
Workload version: 8.0.100-manifests.825c015e -
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Metadata
Metadata
Assignees
Labels
Type
Projects
Status