# OR keyword in CQL (Confluence): syntax and examples

URL: https://goingstellar.ro/reference/cql/or-keyword/

OR joins clauses and returns content that matches at least one of them. Use it to widen a search across spaces, words or dates. It binds weaker than AND, so group it with parentheses whenever you combine the two.

## Syntax

```
clause1 OR clause2
(clause1 or clause2) and clause3
```

## Arguments

- `clause` (optional: yes): Any CQL clause of the form field operator value.

## Works with

- Operators: joins clauses that use any operator.
- Functions: any function inside a clause, such as startOfYear() or now().
- Not with: a leading or trailing OR. It needs a clause on each side.

## Examples

```
space = SD or space = "Gigi"
```

Searches two spaces at once. Run on Confluence Cloud on 2026-11-29.

```
title ~ "runbook" or title ~ "handbook" or title ~ "policy"
```

Finds the operating documents of a team under any of three names. Run on Confluence Cloud on 2026-11-29.

```
type = page and (title ~ "runbook" or title ~ "policy") and space = SD
```

Keeps the either-or part inside parentheses so the type and space limits apply to both words. Run on Confluence Cloud on 2026-11-29.

```
lastModified < startOfYear() or label = needs_review
```

Pulls stale content together with anything someone flagged for review. Taken from the documentation with a label that suits a review queue. Run on Confluence Cloud on 2026-11-29.

```
title ~ "runbook" or title ~ "handbook" order by title
```

Shows results from both words in alphabetical order. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- OR does not cut AND short. In `type = page and space = SD or type = attachment` the AND pair is evaluated first, then OR adds every attachment from any space. Wrap the OR in parentheses to limit it.
- When OR compares one field with several values, IN is easier to read and edit: `type in (page, attachment)` replaces two = clauses.
- Lowercase `or` works the same as `OR` (checked on Confluence Cloud, November 2026). A query that begins with OR is a syntax error.
- An OR on a field with no data is not an error. A label clause on a space without labels just matches nothing, so the rest of the query still returns results.

## Related

- [AND](https://goingstellar.ro/reference/cql/and-keyword/)
- [NOT](https://goingstellar.ro/reference/cql/not-keyword/)
- [IN](https://goingstellar.ro/reference/cql/in-operator/)
- [ORDER BY](https://goingstellar.ro/reference/cql/order-by/)
- [lastmodified](https://goingstellar.ro/reference/cql/lastmodified-field/)
- [label](https://goingstellar.ro/reference/cql/label-field/)

## Sources

- [CQL keywords (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-keywords/)

