The following modules are powered by CQL: News, Activity, Search and Pages
Sites and categories introduced by RefinedTheme can be used in a CQL statement.
Key | Type | Description | Example query |
---|---|---|---|
refinedSite | number | The site id. You can find the site Id in the Site Builder. Click edit on a site and take the site id from the url. | refinedSite = 123 |
refinedCategory | string | The category key. | refinedCategory = hr |
RefinedTheme 6.1
CQL function() | Description | Example |
---|---|---|
blogs() | Returns all spaceKeys for spaces marked as 'Blog spaces' | type = blogpost AND space IN blogs() |
blogSite() | Returns all spaceKeys for spaces placed in the Blog Site | type = blogpost AND space IN blogSite() |
Atlassian CQL Documentation
Read this document to learn more about CQL: https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/
Examples
Pages CQL
Display the user's favorite pages
See example below under the "my favourite pages' section in image.
favorite = currentUser() and type = page
List all my mentions
siteSearch ~ "$username*" and mention = currentUser()
News CQL
Get all blog posts from a site
type = blogpost AND refinedSite = 123 ORDER BY created DESC
Get all blog posts from a category
type = blogpost AND refinedCategory = hr ORDER BY created DESC
Get all blog posts added by the current logged in user
Tip: Text Variables can be used to construct CQL queries.
type = blogpost AND creator = $username ORDER BY created DESC
Get all blogposts from the blog site
type = blogpost AND space IN blogSite() ORDER BY created DESC
Get all blogposts from blog spaces
type = blogpost AND space IN blogs() ORDER BY created DESC
You can also make use of any third-party CQL additions as well (RefinedTheme 6.1).
Tailoring the search with CQL
Ticking the box or not?
For the Search module. If you want to add your own complete CQL statement, make sure to uncheck/untick the box in the image above. When the box is ticked/checked the user entered word, $query, will be used for title and label search, i.e. (title ~"$query*" or label in ("$query")) prepended with an and.
Search Confluence Questions for questions or answers (RefinedTheme 6.1)
type = "com.atlassian.confluence.plugins.confluence-questions:answer" or type = "com.atlassian.confluence.plugins.confluence-questions:question"
Search all content using the CQL: text ~"*$query*" - box checked
text ~"*$query*"
Search all content and labels and titles - box unchecked
text ~"$query*" or title ~"$query*" or label in ("$query")
Search Confluence for users
siteSearch ~ "$query*" and type = user
Search my mentions
siteSearch ~ "$query*" and mention = currentUser()
Search all content within a space using the CQL
text ~"*$query*" and space.key=$spacekey