Firestore algolia query all categories nest

Hi… im starting a “store” app ,with some levels of categories (not really needed to be dynamic)… using nativescript and there´´s a port of algolia javascript api cloned to it… (not that this can be too much relevant i think)

i was studying about noSQL patterns and stuff, and reading about firebase / firestore…
i studied a bit of hierarchical and understand that Materialized Path is the best one… (kind of nesting things as firestore suggests)
also i was reading in forums that firestore actually cant query on subcollections…

said that im lost, and want to ask a couple of questions about all this new stuff:

1 - i didnt get really what firestore means with subcollection “links”, since sometimes it seems like just normal objects.

2 - when google engineer said in a forum that actually firestore dont “query” on subcollections, what he meant? with query? some restriction? and normal filtering? im asking that because there´´s an option on firestore api to search in all children collections

3 - independently of my “1 and 2 questions”, how i would use algolia? indexing each item of subcollection too, like in a flat index? or there´s some strategies? i read on algolia manual that i can implement cloud functions to update each item, so at the end it becames a flat index?

thanks for now…!!!

Hi @xtronoid, thanks for posting your question. I’ve asked a dev from the Firestore team to drop by and provide some guidance on #1 and #2.

For #3 - Yes, in most cases we see you will just flatten your Firestore hierarchy into one index per top-level object (users, posts, etc.). The Algolia record can be flat or nested - in either case you can configure exactly which attributes you want to be searchable and which fields matter more for relevance. The objectID for your records will be something like user-123 where user will reflect the top-level of your Firestore object tree.

Hello @dzello, thanks for replying!!!

well, at the end of day flat or nested in algolia it´s only related to faceting? i think its cool to get the itemscount in one calling… sorry my anxiety, i´ve just in the part of starting this part of the app, just when firestore is rising…

i hope that things starts to clear with time :slight_smile:

many thanks by now!

1 Like