Closed AlanFoster closed 4 years ago
If you are splitting a single node into multiple, you need to also split the id, for example with the index. In pseudo code:
splitIntoChunks(singleObject).map((item, index) => ({...item, objectID: item.id + '-' + index,}));
This is indeed needed to be able to differentiate between every "part" of the item.
This is not a bug in the library, but rather a fix, since without object id, partial updates won't work and will still need an update on every item.
Thanks!
Hi, I'm following the walkthrough from: https://www.youtube.com/watch?v=VSkXyuXzwlc&feature=emb_logo
The walkthrough shows how to create search terms for a single blog post.
The solution creates multiple records from a single blog post on Algolia without an
objectId
, and removes duplication via theslug
attribute via the index's settings.However This doesn't work in the latest release of
gatsby-plugin-algolia
due to the following check added in https://github.com/algolia/gatsby-plugin-algolia/pull/27/files#diff-fda05457e393bada716f508859bfc604R103-R107When adding the objectId:
This causes the last write to Algolia to win, and it removes the duplicate search records for the same blog post. This means there's now one record for each blog post, the last one, rather than multiple search snippets for each post as required.
Is the approach taken by the video the correct solution for chunking blog posts into multiple search terms on Algolia? Or is there a regression in the library