containsAny
Full name: taxi.stdlib.containsAny
Signature
declare extension function <T> containsAny(collection: T[], searchTarget:T[]): BooleanDescription
Returns true if the collection contains at least one of the specified search targets.
Returns true when searchTargets is empty (symmetrical with containsAll).
// Check whether a product has any of a set of tags
find {
isRelevant: Boolean = ProductTag[].containsAny(['sale', 'featured', 'new'])
}Known limitation: When the collection uses a semantic type (e.g. ProductTag inherits String),
passing string literals as searchTargets always returns false due to a type comparison bug.
See problems/containsAny.md. Use a String[] collection as a workaround.
Examples
Returns true when the collection contains at least one of the search values, false when none match.
Try it out
Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed