Skip to content

[BUG] Azure.Search.Documents performs vector search successfully, but results are "null" #44558

Open
@rossmodolin

Description

@rossmodolin

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:

2024-06-07 Debugging - Microsoft Visual Studio

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:

image

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

ClientThis issue points to a problem in the data-plane of the library.Searchcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions