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
158 stars 34 forks source link

Support backfill documents in subcollections #17

Open eysenshi opened 3 years ago

eysenshi commented 3 years ago

Description

This is a request to support backfill all subcollections return from a collection group query. This could be helpful in use case like, backfill landmarks data from all cities under path: cities/{cityId}/landmarks.

jasonbosco commented 2 years ago

Note to myself: docs for listening on dynamic paths: https://firebase.google.com/docs/functions/firestore-events#wildcards-parameters

elhe26 commented 2 years ago

@jasonbosco, this extension supports subcollection paths? (ie. cities/{cityId}/landmarks)

ChauCM commented 2 years ago

Subcollection like "cities/{cityId}/landmarks" worked for me on indexToTypesenseOnFirestoreWrite but not on backfill: backfillToTypesenseFromFirestore. Basically the backfill function runs without error but no record is imported.

guenth39 commented 1 year ago

@jasonbosco Any plans to implement this? I would really need this feature!

guenth39 commented 1 year ago

The issue should be fixed by changing this line in the backfill cloud function https://github.com/typesense/firestore-typesense-search/blob/44e01a71bb881a60eea7f016ed53c577fefe2e99/functions/src/backfillToTypesenseFromFirestore.js#L43-L44 In the case of a subcollection, we have to use collectionGroup instead of collection.