Implement new operator: has_substring within in_collection
JulianGoetz opened this issue · 3 comments
Not sure how broad the use case is for this, but I ran into an application this morning.
Example query: all companies in the US whose names include the name of any of the presidents sculpted into the side of Mount Rushmore.
Would be pretty sweet to run this as one query! As of writing, there are only four faces on the side of Mount Rushmore. But in the future, who knows! Other examples could require many more in_collection too that would be tedious to write out as individual queries.
from @chewselene: "might make sense to just have the input of @has_substring be a list, which would allow for single of multiple substrings without requiring a second directive"
We unfortunately can't change has_substring
to take a list instead of a single string, since that'd break all current uses of has_substring
that use only a single string. And allowing has_substring
to take both a string and a list of strings would be problematic since we would then have to infer something like union StrOrList = String | [String]
as the type of the input argument, which would introduce its own complexities.
The cleanest way forward is probably a new operator dedicated to this purpose. Any suggestions on what it should be named? has_substrings
sounds like it would require all substrings instead of any of them, and everything else I can think of feels too verbose...
How about has_any_substring
?