I have a data type called “skill” and it have a “name” of type text. Also I have another data type called “course” which have “name” of type text, and “skills” (a list) of type “skill”.
When the user enter a keyword in the search input, it navigate to another page (search page) with the keyword in the link as a parameter. In the search page there is a list of skills (related to the keyboard) from which the user can choose some.
So if the keyword was “nocode”, the skills may be bubble, flutterflow, webflow, etc, and the user may select bubble and webflow.
The RG in the search page do a search for courses which have the keyword in its “name” field OR have the keyword in the “name” field of any item of its “skills” field OR have the selected skills in its “skills” field.
How to retrieve the courses that have the keyword in the name of any item of its skills?
And how to retrieve the courses that have the selected skills in its skills?
I am trying to avoid using :filtred because then I have to retrieve ALL the courses then filter them.
You could have a ‘search’ field on your Course data type. It is of type text. Set that text to be the name of the Skill. You can set this up using a trigger (e.g when Skill’s now’s name is now Skill before’s name, Make changes to Skill’s Course and set field ‘search’ to Skill now’s name). This will ensure that the search field is always in sync with your skill names If you end up adding things like skill descriptions, you can also add those to the same search field.
Thank you @georgecollier
this solution may work to retrieve the courses that have the keyword in the name (or description) of any item of its skills, but what about retrieving the courses that have the selected skills in its skills?
Nah, that’s was just for the info that simple constraints that are used in :filtered operator are still “merged” with Do a search and applied server-side. But Advanced filter is always client-side.
If I’m not mistaken, you want to display the following in a repeating group:
Any courses whose list of skills contains the URL parameter’s Skill
Any courses whose Name contains URL parameter’s Skill’s Name (but doesn’t have to have the Skill in its List of Skills)
I might try this way as it’s straightforward and see how it impacts performance as bubble does some under the hood optimizations with caching searches.
Rather than doing this in 1 filter, you can break this up into two searches, then merge the resulting lists.
That would look something like this on your repeating group:
Do a search for Courses:filtered(List of Skills contains (Get Skill from URL) merged with Do a search for Courses:filtered(Name contains (Get Skill from URL's Name)
In this example Merged with removes any duplicates which may appear in both searches and returns a single list.
That close @javier6, and would work, but also in the same RG I want to display any courses whose list of skills contain any skill selected by the user in a multy dropdown, I mean after the user arrive to the search page with the keyword in the url, he also my select some skills as an additional filter
Just in case anyone passes by here, the solution I adopted is to add a field for courses in the “skill” data type so I can search for skills then getting related courses
I would just move the data source on the repeatinggroup into a state on the page, then populate it on pageload, then the repeatinggroups new datasource would be
Custom State's List of Skills merged with Multidropdown's Value
Then the multi-dropdown’s datasource would be
Do a search for Skills:minus list (Custom State's List of Skills)
This way you have your original repeating group, then a dropdown which does not contain any of the skills you’ve mentioned so far, unless you want it to, in which case you’d have to change the datasource filter on there. Then any additional changes to the multidropdown would reflect in the repeater plus the original searches you conducted