Skip to main content
Improve Confluence search with CQL autocomplete
Share on socials
ScriptRunner magic for Confluence
Lisa Murray
Lisa Murray
23 May 2023
Data center icon

Improve Confluence search with CQL autocomplete

Get accurate search results in Confluence faster and easier than ever with the latest improvements to ScriptRunner Enhanced Search. Find out everything you need to know about CQL autocomplete.
We all dream of the perfect Confluence space. Where pages are kept up-to-date by your colleagues; pages, child pages and grandchild pages are stored in a logical order; and your teammates can confidently find the pages they need.
To achieve this dream Confluence space, you're working hard. You're removing irrelevant pages, asking departments to update their stagnant pages, and even re-uniting families by moving wayward child pages to their actual parent pages.
Unfortunately, chances are you've not quite achieved that Confluence utopia yet, and Blake from accounting can't find the page they're looking for. They checked in the directory they thought it was stored under, then they combed the page tree, and now they're starting to run out of time before the meeting they need the page for.
So what do they do next? They try to search for the page.
Woah. Hang on, Blake.
This is not [insert popular search engine here].
This is Confluence.
Blake's six different searches go about as well as the training session you once scheduled on a Friday at 4pm.
The page does not show in the results.
And now Blake is asking if you know how to find this elusive page.

Why is Confluence search so…?

We love Confluence. We don't love Confluence native search. Atlassian have it on their roadmap for improvements and we can't wait to see those changes arrive.
In the meantime, and mercifully, since Blake literally can't wait, Atlassian provided us with another solution: the ability to search Confluence using Confluence Query Language (CQL). Except, there's no interface for that in Confluence and there's no way Blake is comfortable hurling queries at the REST API.

A better way to search Confluence

ScriptRunner for Confluence provides a search bar which allows you and your users to create those more specific–and therefore more successful–searches. Blake can ditch their method of trying eighteen different combinations of what they thought the document was called and use CQL to get what they're looking for faster. Comb through your Confluence instance to find the pages, blog posts, comments, images, and attachments that you're looking for by clicking on the binoculars icon on the navigation bar or in the sidebar of the Advanced search page.
Where to find ScriptRunner Enhanced Search on Confluence? On the top navigation bar, look for a pair of binoculars.
Enhanced Search sidebar

But I don’t know CQL: how does this search bar help me?

Although the Atlassian documentation for CQL is great, one issue remains: who has time to look up CQL query syntax three minutes before a meeting?
Not you. Not Blake. Not us, either.

Introducing your CQL co-pilot: autocomplete

That's right: the ScriptRunner for Confluence Enhanced Search bar has built-in autocomplete and suggestions. To search, simply start typing and it will suggest how to construct your query.
To get you what you need even quicker, Enhanced Search will also contextually include and exclude options depending on what you type. For instance, if you specify that you'd like to search in a particular Space, then begin adding a search term to filter using labels: you'll only see labels which are used within that Space.
Syntax errors are also highlighted as you type so you can quickly identify and correct any problems.

tl;dr?

You no longer need to search through Atlassian's documentation for the correct syntax for your CQL Query. The full list of CQL fields, functions, keywords and operators is made available as autocompletion options, plus some ScriptRunner-specific search functions that you don't get with Confluence out-of-the-box.

See how easy it is in this short video from ScriptRunner expert Sam.

Essential CQL Queries

CQL queries make searching through your Confluence instance a cinch, allowing your users to quickly locate the content they need. Here are our four essential CQL queries that you'll use time and again:
1. Search for a page title within a space, created in the past year
space = “MAR” AND title ~ “brand guideline" AND created >= now("-1y")
2. Search for a blog post with a particular label
Type = blogpost AND label = launch
3. Search for content where the creator or contributor is either Violet or Eliza
creator in (vburton,ewong) or contributor in (vburton,ewong)
4. Search content containing multiple keywords. For example, the words "resources" and "library"
text ~ "resources library"

Grab our Top 10 CQL cheat sheet

To help you and your team get up to speed quickly, download our beginner-friendly Top 10 CQL queries cheat sheet.

Get started

Ready to try it for yourself?
CQL Autocomplete is available from version 8.3.0 of ScriptRunner for Confluence Data Center onwards.
If you have updated to the latest version of ScriptRunner, click the binoculars icon in the Confluence navigation (or inside the sidebar in the Advanced Search section of Confluence) to get started.

Still haven't tried ScriptRunner?

Claim your 30-day free trial.