typesense / firestore-typesense-search

Firebase Extension to automatically push Firestore documents to Typesense for full-text search with typo tolerance, faceting, and more
https://extensions.dev/extensions/typesense/firestore-typesense-search
Apache License 2.0
150 stars 27 forks source link

Feature request: configuration field to call a transform function #76

Open StevenH86 opened 2 months ago

StevenH86 commented 2 months ago

Hey team, I'm in the process of migrating from Algolia to typesense and all is going well, however, the Algolia extension allows us to provide the name of a another function that can transform our document data before writing it to the Algolia index.

This would be extremely useful to have available in the typesense extension. We use it to modify one of the ID's as we are indexing a subcollection that exists nested in multiple places e.g. programs/{programId}/program-users/{userId}. As the docs we are indexing are keyed by the userId we need to append the programId as a suffix to prevent records overwriting each other.

I believe something like a transform function would be useful for a bunch of other lodged issues where people want to exclude records with certain values from their typesense collection. Supporting a returned object like below would be extremely useful.

{ payload: { ... data to sync }, docId: 'someId', action: 'skip' // 'skip' | 'sync' | 'delete' }

This would allow us to have more control over what goes into our typesense collections.

Cheers

jasonbosco commented 1 month ago

I'd definitely appreciate a PR for this