Merge multiple records by same attribute if at least one of them match

I have an index with records splitted like this:

[
  {
    "name": "Product A",
    "sku": "product-a",
    "content": "Large content part 1..."
  },
  {
    "name": "Product A",
    "sku": "product-a",
    "content": "Large content part 2..."
  },
  {
    "name": "Product A",
    "sku": "product-a",
    "content": "Large content part 3..."
  }
]

content is searchable. If user search for something only appear in content part 1, only the first record is returned, is that correct? If yes, is it possible to return a merged record of all records that has same sku like below?

{
    "name": "Product A",
    "sku": "product-a",
    "content": "Large content part 1... Large content part 2... Large content part 3..."
  }

If you have attributeForDistinct set as sku and distinct set to true, this will indeed only show a single result. However you can set distinct to any number. This means that the result set will still show N amount of hits per sku.

You can then group yourself frontend based on the _distinctSeqId which will be available on the hit.

Hope that helps!

For example the SaaS dataset on the “getting started” tutorial follows this approach: https://www.algolia.com/doc/onboarding/#/pick-dataset