Hi, I’m trying to set up a unified search field in my app. The goal is that when a user types in the search bar, it return results from different data types in my database like Profiles, Posts, Lessons, etc containing the searched keywords. I’m trying to avoid using a different repeating group for for each data type because I want to avoid adding several new elements and workflows to my app.
You probably will have to create a Search Data Type with the fields you use to search of each Data Type, that is going to depend in the structure of your app of course
Another option is to search in each DB and use Stacked RG (So your first show profiles results, after in another RG you shoe posts… another one will show lessons..) You could also have a “title” as separators so users know which part of your app the results is linked too.
I’ve built something a long time ago for someone that make 5 DB searchable using one search bar and returning all the results into a single RG. For that, we use the trigger in backend WF and built our own index in a json format that contain informations like title, searchable text, url to item and unique id. So if, for example, you have a “post” page and another “profiles” page, we just needed to use the url to item to navigate easily to the right page without using multiples conditions.
You can handle this by either merging searches from each data type into one repeating group (and using conditionals to format results), or by creating a “Search Index” type that references items with their type. Both approaches avoid multiple repeating groups and keep the UI clean.