Shaun Byrnes
05/10/2023, 1:28 AM{
"created_at": 1681803018,
"default_sorting_field": "fdcId",
"enable_nested_fields": true,
"fields": [
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "fdcId",
"optional": false,
"sort": true,
"type": "int32"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "verified",
"optional": false,
"sort": true,
"type": "bool"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "foodCategoryId",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "foodBrandId",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "deleted",
"optional": false,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "name",
"optional": false,
"sort": false,
"type": "string"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "water",
"optional": false,
"sort": true,
"type": "bool"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "supplement",
"optional": false,
"sort": true,
"type": "bool"
}
],
"name": "food",
"num_documents": 23630,
"symbols_to_index": [],
"token_separators": []
}
We have the following source data in Firebase, but instead see the portionSize
object flattened in Typesense with fields like portionSize.unit
portionSize.value
etc. It is my understanding that with the latest version and enable_nested_fields:true
objects are now not flattened by default as was the case previously? Or have we misconfigured things?Kishore Nallan
05/10/2023, 5:12 AMShaun Byrnes
05/10/2023, 5:13 AMenable_nested_fields:true
flag set before data was written via the extensionKishore Nallan
05/10/2023, 5:16 AMShaun Byrnes
05/10/2023, 5:16 AMShaun Byrnes
05/10/2023, 5:20 AMKishore Nallan
05/10/2023, 5:22 AMShaun Byrnes
05/10/2023, 11:29 AMShaun Byrnes
05/10/2023, 11:29 AMobject
as field type? In which case it just flattens it ?Shaun Byrnes
05/10/2023, 11:33 AMKishore Nallan
05/10/2023, 11:35 AMobject
Typesense flattens it, but it's done internally for indexing and will not affect the actual response. We don't modify the source document as well.Kishore Nallan
05/10/2023, 11:36 AMShaun Byrnes
05/10/2023, 11:37 AM"portionSize": {
"displayFormat": 0,
"portionsPerItem": null,
"selectedPortionIndex": 2,
"unit": "g",
"value": 1
},
Shaun Byrnes
05/10/2023, 11:37 AMShaun Byrnes
05/10/2023, 11:38 AMShaun Byrnes
05/10/2023, 11:38 AMShaun Byrnes
05/10/2023, 11:38 AMShaun Byrnes
05/10/2023, 11:39 AMportions
[ { "amount": 100, "measureUnitId": "REzO2pZ0K1J6MFrCnWAi", "multiple": 1, "portionSizeId": "GEMDwd7SBYFZ6T9Ui0s2", "type": 0 } ]
Kishore Nallan
05/10/2023, 11:43 AMShaun Byrnes
05/10/2023, 11:44 AMShaun Byrnes
05/10/2023, 11:45 AMShaun Byrnes
05/10/2023, 11:46 AMKishore Nallan
05/10/2023, 11:48 AMShaun Byrnes
05/10/2023, 11:49 AMKishore Nallan
05/10/2023, 11:49 AMWhat does querying it from the JS client do to help if you are saying that you can see the response does have the data flattened out ?To see if the same problem happens on vanilla JS client as well.
Kishore Nallan
05/10/2023, 11:49 AMShaun Byrnes
05/10/2023, 12:31 PMShaun Byrnes
05/10/2023, 12:31 PMShaun Byrnes
05/10/2023, 12:31 PMKishore Nallan
05/10/2023, 12:31 PMKishore Nallan
05/10/2023, 12:41 PMKishore Nallan
05/10/2023, 12:46 PMKishore Nallan
05/10/2023, 12:50 PMJason Bosco
05/10/2023, 3:51 PMShaun Byrnes
05/11/2023, 1:10 AMShaun Byrnes
05/11/2023, 1:13 AMShaun Byrnes
05/11/2023, 1:13 AM...
"portionSize": {
"displayFormat": 0,
"portionsPerItem": null,
"selectedPortionIndex": 0,
"unit": "g",
"value": 1
},
...
Shaun Byrnes
05/11/2023, 1:14 AMShaun Byrnes
05/11/2023, 1:14 AMJason Bosco
05/11/2023, 3:19 AMportionSize.displayFormat
on the Search Dashboard. If you upgrade to v1 of the extension, that now has a toggle in the extension configuration called “Flatten nested objects”, you want to set that to No and then run a backfill against a new Typesense collection. That will sync the documents as is instead of flattening it like how you’re seeingShaun Byrnes
05/12/2023, 6:40 AMShaun Byrnes
05/12/2023, 6:41 AMShaun Byrnes
05/12/2023, 6:42 AMShaun Byrnes
05/12/2023, 6:44 AMJason Bosco
05/12/2023, 8:06 PMShaun Byrnes
05/13/2023, 12:39 AMShaun Byrnes
05/13/2023, 12:40 AMFlatten nested objects
flag enabledShaun Byrnes
05/13/2023, 12:40 AMJason Bosco
05/13/2023, 12:47 AMShaun Byrnes
05/13/2023, 12:48 AMShaun Byrnes
05/13/2023, 12:48 AMJason Bosco
05/13/2023, 12:48 AMShaun Byrnes
05/13/2023, 12:48 AMShaun Byrnes
05/13/2023, 12:48 AMShaun Byrnes
05/13/2023, 12:49 AMJason Bosco
05/13/2023, 12:49 AMShaun Byrnes
05/21/2023, 11:19 PM1.0.3
seem to be working well, will advise when we can also do this on prod