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
159 stars 35 forks source link

How to index Firestore subfields? #14

Closed theshadowagent closed 2 years ago

theshadowagent commented 3 years ago

Description

I have a Firestore collection with subfields e.g. { "user": {"username": string, ...} } and installed firestore-typesense-search extenstion. I want to create a Typesense collection with indexing by user.username without duplicating this in a flat field like user_username in Firestore.

Is it possible? I've tried specifying user.username,... in extension configuration, but that doesn't seem to work.

jasonbosco commented 3 years ago

Hi @theshadowagent, Typesense doesn't support nested fields at the moment (we're tracking it as part of https://github.com/typesense/typesense/issues/227). So you would have to flatten fields to top-level keys to index them in Typesense. So for eg, {"user": {"username": string}} needs to be {"user_username": string}.