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

Add support for multiple collections to be indexed in typesense #9

Closed georgekamar closed 3 years ago

georgekamar commented 3 years ago

Description

This is not a bug with the extension, but a request to add a feature that would allow support for multiple collections to be indexed into typesense. The configuration steps could allow an array or list of collections to be inputted, and a subarray for fields.

jasonbosco commented 3 years ago

@georgekamar To sync multiple collections, you can actually install this extension multiple times in the same project and set different collection names, in each instance.

georgekamar commented 3 years ago

That thought did cross my mind, but I wasnt sure if it was possible, how to manage that, and was hoping there was a way to achieve desired functionality in one installation.

p.s: tried copying the code and modifying locally, but for some reason functions.handler.firestore.document.onWrite(...) does not register as an event, despite it being in firebase's documentation

jasonbosco commented 3 years ago

To install a 2nd instance of the extension, you'd just need to click on the Install Extension link in the README file of this repo and select your Firebase project as usual. Firebase will detect that you already have the extension installed and will prompt you to enter a new "extension instance id" like this:

Screen Shot 2021-07-23 at 3 12 34 PM

Besides that, everything about the installation procedure is the same.


p.s: tried copying the code and modifying locally, but for some reason functions.handler.firestore.document.onWrite(...) does not register as an event, despite it being in firebase's documentation

IIRC, functions.handler.firestore is a Firebase extension specific thing. To write your own handler in a firebase app, you want to use functions.firestore like this: https://typesense.org/docs/0.21.0/guide/firebase-full-text-search.html#step-3-write-data-to-typesense

georgekamar commented 3 years ago

Thanks for the answers, very helpful !