Finding what you’re searching for in Confluence Cloud often feels like a hit-or-miss situation. When dealing with an endless pool of pages and documents within your wiki, it’s never too late to sharpen your advanced search skills and have some tricks up your sleeve. Hence, we present CQL or Confluence Query Language!
What is Confluence Query Language?
As explained in the Atlassian documentation:
“An advanced search allows you to use structured queries to search for content in Confluence. Your search results will take the same form as the Content model returned by the Content REST API.”
Our favorite CQL statements
1. Find content that has been favorited by the current user
favourite = currentUser()
Simply put, whatever space/page you’ve “Starred” will show up as a search result. In order to “Star” a space/page, you can simply click on the button/icon as shown in the pictures below:
2. Find a page containing a Confluence macro
type = page AND macro = ‘macrokey’
If you want to find the key of a specific macro, you can simply go to your Confluence settings and choose “Macro Usage”. A list of all your macros and their keys will be visible.
3. Find content that was last modified before the start of the year
lastmodified < startOfYear()
4. Find child pages of a parent page with a specific ID
parent = 123
123 – Parent page ID
Find out how to find a specific Confluence page ID easily as provided by Atlassian’s documentation.
5. Find all the content (pages or blog posts) that you created and order them in descending order
contributor = currentUser() AND type IN (‘page’, ‘blogpost’) order by created desc
6. Find content that doesn’t have the label ‘draft’ or ‘review’
label not in (draft, review)
7. Find all content that mentions a user but was not created by the same user
mention = “99:27935d01-XXXX-XXXX-XXXX-a9b8d3b2ae2e” and creator != “99:27935d01-XXXX-XXXX-XXXX-a9b8d3b2ae2e”
How can I execute a CQL query in Confluence Cloud?
As explained by Atlassian in their documentation:
Another way is by using a well-beloved app by Communardo, SubSpace Navigation for Confluence.
The app helps you easily build a customizable navigation menu in Confluence Cloud, which can include: links, spaces, folders, and (you guessed it!) CQL queries.
You can simply paste a CQL query in the input field and your drop-down navigation will display all the search results. See the example below:
SubSpace Navigation for Confluence Cloud make CQL searches customizable and much easier to find. Save yourself time and frustration. Let us know what are your favorite CQL queries in the comments below.