'Xcode - Displaying variations of using Firebase and Algolia

I've got data in my Algolia index and Firebase Database that are stored as presented in the first image.

enter image description here

There is a parent exercise (in this case "Chest Press") which has two variation factors ("type" and "variation"). When a user searches for an exercise, I would like the data to be presented as shown in the second image.

enter image description here

Is this possible using my current database structure? Any help would be greatly appreciated. Thanks



Solution 1:[1]

I would flatten this out in your index so that each exercise/variation is a unique record. This will aid Algolia indexing and speed up search.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chuck Meyer