New collections integration creating "empty" records

We are using the new “Enable faceting on collections” option in the Shopify app. This option adds a new collections key to each product record which contains an array of collections that the product is in.

We have noticed that this combined with the “Real time indexing” option is removing data from our indice.

It seems to be fine until an admin updates a collection (e.g. adding an image or updating the description). This then presumably fires a webhook to Algolia to reindex the products within that collection and repopulate the collections key.

When this webhook is fired, all product data from the primary indice is removed (see screenshot attached).

My assumption is that rather than doing a partial record update, this process is overwriting the entire record with just the objectID and the collections key.

Each of the records in the screenshot should be containing the full product data (title, price, tags etc).

On further investigation, it seems what’s actually happening is that when a collection itself is updated, all the member products are pushed into Algolia regardless of their published status. This results in a whole bunch of “empty” records as they never existed in the first place.

My assumption is that for each of those in the screenshot, Algolia thinks they already exist in the index so is trying to overwrite the collections key but is actually inadvertently creating a whole new half-populated record.

The logic needs to be updated to only update existing records, not insert new ones.

Nice catch!
@charly.poly do we properly ignore products / variants which should be ignored on a collection update?

Is there any update on this?

I believe this may have been fixed as I haven’t seen it occur for a while but would be great to clarify.

Hi @subscriptions_zomp,

This issue has been fixed on our indexing side a month ago.
We know properly ignore products if needed when updating a collection.

Regards,