# containsAny

Source: https://taxilang.org/docs/language/stdlib/containsAny

**Full name:** `taxi.stdlib.containsAny`

## Signature

```taxi
declare extension function <T> containsAny(collection: T[], searchTarget:T[]): Boolean
```

## Description

Returns `true` if the collection contains at least one of the specified search targets.

Returns `true` when `searchTargets` is empty (symmetrical with `containsAll`).

```taxi
// 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.

Schema:

```taxi
model Product {
   name: String
   tags: String[]
}
```

Query:

```taxi
given {
   product: Product = { name: 'Laptop', tags: ['electronics', 'portable', 'work'] }
}
find {
   hasAnyTag: Boolean = product.tags.containsAny(['gaming', 'portable'])
   hasNone: Boolean = product.tags.containsAny(['gaming', 'sports'])
}
```

Result:

```json
{
  "hasAnyTag": true,
  "hasNone": false
}
```
