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

Matching Schemas and Collections. #21

Closed elhe26 closed 2 years ago

elhe26 commented 2 years ago

Description

Using this schema:

let schema = {
  'name': 'companies',
  'fields': [
    {
      'name': 'company_name',
      'type': 'string',
      'facet': false
    },
    {
      'name': 'num_employees',
      'type': 'int32',
      'facet': false
    },
    {
      'name': 'country',
      'type': 'string',
      'facet': true
    }
  ],
  'default_sorting_field': 'num_employees'
}

firestore collection:

{
"company_name": "abc inc",
"num_employees": "50"
}

Could we have a collection with missing parameters (ie. country) and upload the missing parameters after? For example, uploading the missing parameter (or parameters) after a document is added in firestore (using a trigger after each creation, update, deletion).

Edit:

To be clear, the collection won't have the parameter but the schema will have it. We add the parameter to that record after each modification.

elhe26 commented 2 years ago

We can declare a field as optional by adding "optional": true.

Thanks Kishore Nallan.