Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new operator: has_substring within in_collection #878

Open
JulianGoetz opened this issue Jul 7, 2020 · 3 comments
Open

Implement new operator: has_substring within in_collection #878

JulianGoetz opened this issue Jul 7, 2020 · 3 comments

Comments

@JulianGoetz
Copy link
Collaborator

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.

@JulianGoetz
Copy link
Collaborator Author

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"

@obi1kenobi
Copy link
Contributor

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...

@LWprogramming
Copy link
Collaborator

How about has_any_substring?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants