json: cannot unmarshal number into Go struct field SearchGroupedHit.grouped_hits.group_key of type map[string]interface {}
filterString := fmt.Sprintf("productSlug:=%s", productSlug)
searchParams := &api.SearchCollectionParams{
Q: "*",
QueryBy: "searchText0,searchText1,searchText2",
FilterBy: &filterString,
GroupBy: utils.Ref("productID"), // utils.Ref just gets a pointer
GroupLimit: utils.Ref(1),
}
resp, err := tsClient.Collection(collection).Documents().Search(searchParams)
{
"name": "product_variants_all",
"fields": [
{
"name": "searchText0",
"type": "string",
"facet": false,
"optional": false,
"index": true,
"sort": false,
"infix": false,
"locale": ""
},
{
"name": "productSlug",
"type": "string",
"facet": false,
"optional": false,
"index": true,
"sort": false,
"infix": false,
"locale": ""
},
{
"name": "searchText1",
"type": "string",
"facet": false,
"optional": false,
"index": true,
"sort": false,
"infix": false,
"locale": ""
},
{
"name": "searchText2",
"type": "string",
"facet": false,
"optional": false,
"index": true,
"sort": false,
"infix": false,
"locale": ""
},
{
"name": "rankingScore",
"type": "float",
"facet": false,
"optional": false,
"index": true,
"sort": true,
"infix": false,
"locale": ""
},
{
"name": "productID",
"type": "int32",
"facet": true,
"optional": false,
"index": true,
"sort": true,
"infix": false,
"locale": ""
}
],
"default_sorting_field": "rankingScore",
"enable_nested_fields": true,
"symbols_to_index": [],
"token_separators": []
}