Skip to content

28. February 2025

Product family in Search (for developers)

To enable the display of product families in search results, we have added the ability to ingest product family information into the search index. This is useful when managing multi-level product families and wanting to show family details in search results. An example of a product family could be a product available in different sizes and colours (known in PIM as master/variant hierarchies).

Example of a PIM product family

Ingesting product family information

To ingest product family information into the search index, you need to include family details in the request model for the

/api/ingestion/segments/{segmentId}/products/create-or-patch

endpoint in the Admin API. Here is an example:

{
    "name": "Woolen socks",
    "shortDescription": "Some nice woolen socks",
    "longDescription": "Some very nice and warm woolen socks",
    "productNumber": "prod-1",
    "rating": 3.5,
    "activeFromUtc": "2000-01-01",
    "activeToUtc": "2200-01-01",
    "alternativeIds": [
        "MySocks-external"
    ],
    "alternativeSearchWords": [
        "Socks"
    ],
    "metadata": {
        "splash": "New"
    },
    "categories": [
        {
            "categoryPathElements": [
                {
                    "categoryId": "c-1",
                    "categoryName": "Women's socks"
                }
            ]
        }
    ],
    "media": [
        {
            "type": "Image",
            "url": "http://example.com/sock.jpg",
            "metadata": "600X400"
        }
    ],
    "familyModel": {
        "familyId": "my-colored-socks"
    },
    "productId": "my-socks"
}

In the example above, the familyModel object contains the familyId property, which is the unique identifier for the product family.

Showing product family information in the search results

When using the /search endpoint in the Search API, family information is included in the search results. Here is an example of how it is returned:

{
  "products": [
    {
      "id": "my-socks",
      "alternativeIds": [
        "MySocks-external"
      ],
      "productNumber": "prod-1",
      "name": "Woolen socks",
      "shortDescription": "Some nice woolen socks",
      "longDescription": "Some very nice and warm woolen socks",
      "media": [
        {
          "url": "https://my-image-url.jpg",
          "type": "Image",
          "metadata": "600X400"
        }
      ],
      "metadata": {
        "splash": "New"
      },
      "categories": [
        [
          {
            "name": "Toys or car parts",
            "id": "cat-toys-1"
          }
        ]
      ],
      "family": {
        "familyId": "my-socks",
        "totalSiblings": 1,
        "siblings": [
          {
            "productId": "my-socks",
            "productName": "Woolen socks",
            "media": "https://my-image-url.jpg"
          }
        ]
      },
      "skus": [
        {
          "id": "my-socks-42",
          "skuNo": "xs",
          "ean": "0012345678905",
          "name": "Red Paint",
          "metadata": {
            "splash": "New"
          },
          "price": {
            "price": 90,
            "listPrice": 100
          },
          "stringAttribute": null,
          "numberAttributes": null,
          "intervalAttributes": null
        }
      ]
    }
  ],
  "facets": [
    {
      "key": "color",
      "name": "Color",
      "facetType": "Term",
      "max": 30.6,
      "min": 10.1,
      "selectedTo": 20.3,
      "selectedFrom": 15.4,
      "values": [
        {
          "count": 30,
          "isSelected": false,
          "key": "green",
          "value": "Green"
        }
      ],
      "match": "any"
    }
  ],
  "suggestions": [
    "Shorts for women"
  ],
  "didYouMean": [
    "Shorts for women"
  ],
  "relatedTags": [
    {
      "tag": "…",
      "suggestionPhrase": "…"
    }
  ],
  "numberOfRequestedProductResults": 1,
  "totalProducts": 1,
  "totalSkus": null,
  "totalSuggestions": 1,
  "totalRelatedTags": 1,
  "originalPhrase": null,
  "usedPhrase": null,
  "productOffset": 0,
  "numberOfRequestedContentResults": 1,
  "totalContent": 1,
  "content": [
    {
      "contentId": "my-page",
      "path": "…",
      "name": "…",
      "shortDescription": "…",
      "media": [
        {
          "type": "Image",
          "url": "http://example.com/sock.jpg",
          "metadata": "600X400"
        }
      ],
      "stringAttribute": null,
      "numberAttributes": null,
      "metadata": {
        "splash": "New"
      }
    }
  ],
  "explanation": [
    {
      "description": null,
      "details": [
        {
          "description": null,
          "details": [

          ]
        }
      ]
    }
  ]
}

Note

Please note that the number of siblings returned in the search results is controlled by the scope.

Number of siblings is controlled by the scope
Number of siblings is controlled by the scope

You can find more information about family data in the Search documentation.