CQL Guide
CQL (Confluence Query Language) is used by confluence_search to find content. You can also use simple text queries that automatically use siteSearch.
Basic Syntax¶
CQL queries follow the pattern: field operator value
Common Operators¶
| Operator | Description | Example |
|---|---|---|
= |
Exact match | type = "page" |
!= |
Not equal | type != "comment" |
~ |
Contains text | title ~ "meeting notes" |
IN |
Match any in list | space IN ("DEV", "TEAM") |
>, <, >=, <= |
Comparison | created >= "2024-01-01" |
Common Fields¶
| Field | Description | Example |
|---|---|---|
type |
Content type | type = "page" or type = "blogpost" |
space |
Space key | space = "DEV" |
title |
Page title | title ~ "architecture" |
text |
Full text search | text ~ "API documentation" |
label |
Content label | label = "approved" |
creator |
Created by | creator = "john.doe" |
created |
Creation date | created >= "2024-01-01" |
lastModified |
Last modified | lastModified >= "2024-06-01" |
ancestor |
Parent page ID | ancestor = "12345678" |
parent |
Direct parent ID | parent = "12345678" |
Search Types¶
CQL Query¶
Pass a CQL string directly:
Simple Text Search¶
Pass plain text — confluence_search auto-detects and uses siteSearch:
Practical Patterns¶
Pages in a Space¶
Recently Modified Content¶
Content with Specific Label¶
Personal Space Search¶
Warning
Personal space keys starting with ~ must be quoted in CQL: space = "~username"
Pages Under a Parent¶
Full Text Search in Space¶
Tips¶
Tip
For simple searches, just pass plain text to confluence_search — it uses siteSearch by default, which mimics the Confluence web UI search.
Tip
Use siteSearch for relevance-ranked results: siteSearch ~ "important concept"
Warning
CQL syntax can differ slightly between Cloud and Server/DC. Test your queries if migrating between platforms.