CQL queries are made up of three parts:
Field (examples: space, creator, lastModified)
Operator (like = or !=)
Value/Function (what you want to search for)
Simple CQL query example
field = "value"
To search for a specific label in your Confluence instances, use the field label followed by the operator = followed by a value test to search for the test label.
Combined CQL statements example
field = "value" AND field = "value"
You can combine CQL statements for more advanced searches using AND and OR.
- Use the previous example of label = "test"
- Add an operator of AND to search for a second statement to search for a label of users, label = "users".
Multiple CQL statements
(field = "value" *AND field = "value") OR (*field = "value")
You can use the order of operations to search for multiple CQL statements.
- Use the previous example of label = "test" AND label = "users"
- Add a statement for the title "Development Work" without needing that space to have the labels of "test" and "users."
Here are some examples of CQL queries:
Return all pages, blog posts, comments, or attachments contained within the DS space:
space = "DS"
Return all pages within the DS space:
space = "DS" and type = page
Return all pages that contain the phrase "start a discussion:
siteSearch ~ "start a discussion"
Return all content created by the currently logged in user:
creator = currentUser()