I'm trying to use Algolia to augment my Firebase backed App. Because of the nature of firebase, a lot of the nested objects have keys that are unique because the data has been flattened and that key represents other interesting data elsewhere in the database that is not within the index being uploaded to Algolia.
An example of an object like this would be:
{
"foo12345": {
"3342523": {
"Body": "Some Text",
"Author": "Bob",
"Last_Updated": 1458071169649
}
}
}
Is there a way to set up a facet on the data inside the nested unique Id object? Is there any way besides facets to filter upon the specific value of keys in Algolia?
I don't think you can use it like that. You need a common path to access the attributes you want to make searchable or use with your facet.
If understand well your case (several 'keys' in the same firebase object), you could try to create a record for each "key" and add an attribute to reference your firebase ID (so you will be able to group them later again)
So you record should looks like:
{ "objectID": "3342523",
"firebaseKey": "foo12345",
"Body": "Some Text",
"Author": "Bob",
"Last_Updated": 1458071169649
}
I recommend this resource to help you connect your firebase data with algolia https://www.algolia.com/doc/tutorials/firebase-algolia
No you cannot do faceting on a nested attribute without knowing its parent. You'll need to reformat your records.
What you can do is the opposite, facet on every children of an attribute:
{
"objectID": 42,
"specs": {
"whatever1": "value1",
"whatever2": "value2"
}
}
Adding specs to your attributesForFaceting will result in having both facets:
specs.whatever1specs.whatever2If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With