algolia / firestore-algolia-search

Apache License 2.0
112 stars 35 forks source link

Combining multiple collections or sub collections, into a single search index #106

Closed dochonglo closed 1 year ago

dochonglo commented 2 years ago

Hello!

I'm interested to know how to set up and combine multiple collections or sub collections into a single search index. For example, my sub collections in Firestore is in the following configuration: group/1234/activities.

Effectively, I have many groups with different IDs, where each has a sub collection of activities. I'd like for users to search the sub collection of all activities (similar to how a collection group query works).

However, I'm challenged with configuring the extension. At the moment, this is what I have:

Screen Shot 2022-04-18 at 6 33 03 PM (2)

I'd like to know if this is the right way to do this? Is my thinking and implementation correct? If not, what do I need to do differently to achieve my desired result? I've seen approaches where people have installed multiple extension instances, is that an approach that I should be using instead?

Thank you in advance for any help!! Also, would much appreciate it if there are any helpful resources anyone suggest regarding this case! :)

smomin commented 2 years ago

Hey @ismaelbarry

The Algolia Extension does not support multiple collection to one Algolia index at this time. I am currently looking for a way to support this use case but I have not found an elegant solution. I will update this ticket if I can come up with a solution that can address this gap.

smomin commented 2 years ago

also, can you provide me in detail what you are trying to do and the end result json. This way I know my solution will address your use case.

smomin commented 2 years ago

you can look at issue #103 but I am trying to see if I can implement a better approach.

appsforlifeio commented 1 year ago

@dochonglo and @smomin - I found the answer as you all may have. You install a firestore extension for each collection (point the collection path to each unique collection) then point the Index Name to the same index. That's it.

See Algolia blog reference and screenshot https://www.algolia.com/blog/product/announcing-the-firebase-algolia-search-extension/

image