CQL Search Macro

You can add the CQL Search macro to a Confluence page. If you provide the CQL query, the macro executes the search and returns the results as links to pages. The macro is useful to show the results of complex queries on pages, labels, and other Confluence content.

For more information about using CQL, check out CQL Guide

Enable and disable the macro

Even though you cannot edit the CQL Search macro, you can enable and disable it. Navigate to General Configuration > ScriptRunner > Macros, and then select the Actions menu. From there, you can either enable or disable the macro. If you disable it, it cannot be added to pages in your Confluence instance. 

Walkthrough

Watch our video to see the CQL Search macro in action.

Use the macro on a Confluence page

To use this macro, follow these steps: 

  1. Open the Confluence page you want to work with and go into edit mode. 
  2. Select Insert and then Other Macros
  3. When you search CQL in the search bar, CQL Search appears. Select it.
  4. Enter the CQL statement you want to search in CQL and how many results you want to see in Max Results

  5. Select Preview to preview the query.
  6. Select Insert to complete the macro.

Example

In this example, we will add links to meeting notes from the Meeting Notes space to a Meetings Guide page in the New Starter Guide space.. 

  1. Open the Meetings Guide page in the New Starter Guide space. 
  2. Seach for the CQL Search macro from the Other Macros menu.
  3. Enter the CQL query. Since we want to include every page in the space, we use the CQL query space = meeting.
  4. Leave Max Results blank so it adds all pages.
     
  5. Select Insert.

Results

In edit mode, the CQL Search macro looks like this: 

Once you Publish or Save the page, it looks like this: 

Note the Prev and Next buttons to navigate results. 


On this page