Write a query

CQL Search sends one query to Confluence search. The language is Confluence Query Language, the same syntax documented by Atlassian for advanced search.

Updated . Atlassian’s reference: Advanced searching using CQL.

Content type

Most useful queries say what they are looking at, then narrow it.

type = page AND title ~ "runbook"

type can be page, blogpost, attachment, comment, or another content type Confluence indexes. ~ is a text match. = is exact.

Examples

This space

space = currentSpace() AND type = page ORDER BY title ASC

Use this in the macro. currentSpace() becomes the space key of the page you are editing.

Quiet pages

type = page AND lastModified < now("-180d") ORDER BY lastModified ASC

now("-180d") stays relative, so the list is still right next month. Add AND space = currentSpace() in a macro when the list should stay in one space.

Contributions

type = page AND contributor = currentUser() ORDER BY lastModified DESC

The app does not replace currentUser(). Confluence does, as the person who opened the page. On a shared page, each reader’s table is their own.

Child pages

parent = currentContent() AND type = page ORDER BY title ASC

ancestor = currentContent() includes grandchildren as well. Both belong in the macro.

Labeled files

type = attachment AND label = "handbook" ORDER BY lastModified DESC

App rules

Failed queries

The table shows “Search failed” and the message Confluence returned. Check the field name, the quotes, and that ORDER BY uses a field Confluence can sort. A query can also return “Nothing matched,” which means the syntax was fine and the viewer can see zero rows.