CQL (Confluence Query Language) is a query language developed for Confluence, which you can use in some macros and the Confluence search. Confluence search and CQL-powered macros allow you to add fields to build up a search query, adding as many fields as you need to narrow down the search results.

  • Use the Add Field link to add additional filters to your query. Add as many fields as you need.
  • For an OR search, specify multiple values in the same field.
    So to show pages with 'label-a', 'label-b' or both you'd put 'label-a' and 'label-b' in the same Label field, like this:
     
  • For an AND search, add more than one field and specify a single value in each.
    To show only pages with label-a and label-b you'd put 'label-a' in one label field, then add a second Label field to the macro, and put 'label-b' in the second one, like this:

    Put simply, OR values are entered in the same field, AND values are entered in different fields. 
    Only some fields support AND.  If the field does not support the AND operator, you won't be able to add that field more than once.  
  • For a NOT search, enter a minus sign (-) before the label. This will exclude everything with that label.

You can use the following CQL fields to build your query:

FieldRequiredDescriptionOperators
LabelYes

Include pages, blog posts or attachments with these labels.

OR (multiple values in the same field)

AND (multiple Label fields)

With ancestorNo

Include pages that are children of this page.

This allows you to restrict the macro to a single page tree.

OR (multiple values in the same field)
Contributor*No

Include pages or blog posts that were created or edited by these people.

OR (multiple values in the same field)
CreatorNo

Include items created by these people.

OR (multiple values in the same field)
Mentioning userNo

Include pages and blog posts that @mention these people.

OR (multiple values in the same field)
With parentNoInclude only direct children of this page (further sub-pages won't be included)EQUALS (one page only)
In spaceNoInclude items from these spaces.OR (multiple values in the same field)
Including text*NoInclude items that contain this text.CONTAINS (single word or phrase)
With titleNoInclude items that contain this text in the title.CONTAINS (single word or phrase)
Of type*NoInclude only pages, blogs or attachments.OR (multiple values in the same field)

* You can add these fields in CQL-powered macros, but not in search. You can still filter using the same information in search, but they're managed by equivalent search filters so don't appear in the Add a filter menu.

  • No labels