sanity-io / sanity-algolia

Utilities for indexing Sanity documents in Algolia
MIT License
67 stars 16 forks source link

Handle returning an array in serialize method #13

Closed theianjones closed 3 years ago

theianjones commented 3 years ago

When sending long articles from sanity to algolia, I ran into quite a few document size limits. The recommended way of dealing with this is to split the article up by paragraph and create separate objects in algolia.

article

runeb commented 3 years ago

Thank you for your patch @theianjones.

This looks good, and I'm certain useful for larger documents. It is missing some features, though. It would be nice to be able to purge these algolia records if the document is deleted on Sanity, or a visibility function changes them to hidden/not-indexed. This is how this module works today, of course with assuming a 1:1 relationship between sanity _id and algolia objectID.

That can possibly be done by adding a metadata property to the records to indicate from which Sanity document a series of records are spawned, and/or doing an automated known objectID series instead of manually overriding record objectID.

Adding a usage example to the README would also help in discoverability of this feature.

And finally, was there a specific reason you upgraded the sanity client dependency? Did it have anything to do with apiVersion perhaps?

theianjones commented 3 years ago

closing in favor of https://github.com/sanity-io/sanity-algolia/pull/14

runeb commented 3 years ago

@theianjones Your code is available in 1.1.0-alpha prerelease of this module