Imagine I have nodes of type A, and those nodes have a long array of strings. I want to query the nodes that have a string in the array that matches my search but only return the matched array terms instead of the whole array.
In the current state of Dgraph, I don’t believe there is a way to do what you want.
Sets of strings can be used to filter nodes, but no logic to filter the sets themselves.
Furthermore, FYI from personal experience, regex function filters can become quite slow when you start working with a slightly large dataset. And there is also the restrictions that you cannot search for a regex if it is less than 3 characters long.
Just to be clear, IMHO, a lambda will always be a work-around and never a solution. Lambdas come with their own unique set of faults, limitations, and added complexities that shouldn’t be needed.
Lambdas are useful in some situations, but when they get over-utilized and end up being a catch-all due to the lack of actual development of the needed enhancements and bug/security that the community has been asking for for years.