> ## Documentation Index
> Fetch the complete documentation index at: https://avala.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Language

> Reference for Avala's query language used to filter data in the platform and exports

Avala's query language lets you filter dataset items, annotations, and export results using structured expressions. Use it in the search bar, export filters, and the `filter_query_string` parameter in the [Exports API](/docs/api-reference/exports).

## Operators

| Operator | Description              | Example                                 |
| -------- | ------------------------ | --------------------------------------- |
| `=`      | Equal to                 | `annotation.label = "car"`              |
| `!=`     | Not equal to             | `annotation.label != "unknown"`         |
| `>`      | Greater than             | `annotation.attribute.confidence > 0.9` |
| `<`      | Less than                | `annotation.attribute.confidence < 0.5` |
| `>=`     | Greater than or equal to | `annotation.attribute.area >= 100`      |
| `<=`     | Less than or equal to    | `annotation.attribute.area <= 500`      |

## Logical Operators

Combine multiple conditions with `AND`, `OR`, and `NOT`. Use parentheses to control grouping.

| Operator | Description                   | Example                                                                                                 |
| -------- | ----------------------------- | ------------------------------------------------------------------------------------------------------- |
| `AND`    | Both conditions must be true  | `annotation.label = "car" AND annotation.attribute.occluded = "false"`                                  |
| `OR`     | Either condition must be true | `annotation.label = "car" OR annotation.label = "truck"`                                                |
| `NOT`    | Negates a condition           | `NOT annotation.label = "unknown"`                                                                      |
| `( )`    | Groups conditions             | `(annotation.label = "car" OR annotation.label = "truck") AND annotation.attribute.truncated = "false"` |

## Annotation Queries

Filter by annotation properties.

### By Label

```
annotation.label = "car"
annotation.label != "pedestrian"
```

### By Attribute

Query annotation attributes using dot notation:

```
annotation.attribute.occluded = "true"
annotation.attribute.truncated = "false"
annotation.attribute.confidence > 0.8
```

### By Annotation Type

```
annotation.type = "bounding_box"
annotation.type = "polygon"
annotation.type = "cuboid"
```

## Metadata Queries

Filter items by custom metadata fields attached to dataset items. Use the `metadata.` prefix followed by the field name:

```
metadata.weather = "rainy"
metadata.scene_type = "highway"
metadata.time_of_day = "night"
```

<Info>
  Metadata field names are case-sensitive and must match the exact field name used when the metadata was uploaded.
</Info>

## Slice Queries

Filter items that belong to a specific data slice:

```
slice = "training"
slice = "validation"
slice = "edge-cases"
```

## Reference ID Queries

Filter items by their reference ID:

```
ref_id = "frame_00123"
ref_id = "scene_042_cam_front"
```

## String Quoting

Use double quotes around values that contain spaces or special characters:

```
annotation.label = "traffic light"
metadata.location = "San Francisco"
slice = "hard examples"
```

Single-word values do not require quotes, but quoting them is always valid:

```
annotation.label = car
annotation.label = "car"
```

## Examples

**Find all items with car annotations:**

```
annotation.label = "car"
```

**Find items with high-confidence annotations:**

```
annotation.attribute.confidence >= 0.95
```

**Find rainy highway scenes in the training slice:**

```
metadata.weather = "rainy" AND metadata.scene_type = "highway" AND slice = "training"
```

**Find items with car or truck annotations that are not occluded:**

```
(annotation.label = "car" OR annotation.label = "truck") AND annotation.attribute.occluded = "false"
```

**Find items without any pedestrian annotations:**

```
NOT annotation.label = "pedestrian"
```

**Filter by reference ID and annotation type:**

```
ref_id = "frame_00500" AND annotation.type = "cuboid"
```
