Skip to content

MultiSearch with Union=true does not unmarshal returned hits field #204

@TobiasPressler

Description

@TobiasPressler

Issue Description

When using the MultiSearch method with Union: true, the TypeSense server returns search results in a field named hits in the response. However, the Go client appears to only look for a field named results, causing the response data to be inaccessible.

Steps to Reproduce

// Create boolean, string and integer values for parameters
unionTrue := true
queryString := "search term"
pageNum := 1
resultsPerPage := 20

multiSearchResp, err := client.MultiSearch(ctx, &api.MultiSearchParams{
    Page:    &pageNum,
    PerPage: &resultsPerPage,
}, api.MultiSearchSearchesParameter{
    Union: &unionTrue,
    Searches: []api.MultiSearchCollectionParameters{
        {
            QueryBy:    &queryString,
            Q:          &queryString,
            Collection: &[]string{"collection-1"}[0],
        },
        {
            QueryBy:    &queryString,
            Q:          &queryString,
            Collection: &[]string{"collection-2"}[0],
        },
    },
})

Expected Behavior

The multiSearchResp should contain the search results accessible via a structured property.

Actual Behavior

The response contains the data in a field named hits, but the client doesn't properly map this field, making the search results inaccessible through the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions